Archive for xullo 9th, 2006
Os principios de diseño de python son a claridade e sinxeleza do código. Sempre podemos ve-lo Zen de Python importando dende python o módulo this.
Éste é o Zen de Python:
xose@debian:~$ python -c "import this"
The Zen of Python, by Tim PetersBeautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
chúzame -
Din que o francés é a lingua do amor... nin que non houbera outras linguas nas que se poder expresar este sentimento conseguindo a mesa calidade semántica, estética e fonética. Unha desas linguas do amor que o público maioritario descoñece é python. E velaquí un exempro:
if you in (depressed, sadness, resignation):
print 'me, my sweetheart'
if feel(you) is 'lonely' or feel(you) is 'neglected':
talk_me(this)
while always:
I.take_care(you)
if you.love() is not me:
# I will follow in the madness
# I will
break # down...
for emotion in my.heart:
try:
your.lover = me
except:
your.best_friend = me
if you.hate(me):
love(me)
elif I.annoying():
love(me)
else:
love(me, how='deeply', when='now')
chúzame - 


