Python
Par zogzog, lundi 1 novembre 2010 à 18:28 :: Dev
python vient d'être élu Best Programming Language par les lecteurs du Linux Journal.
Ahhhh python....
def python_is_ok(s='do not sux'):
print s
s='sux'
def python_sux(l={}):
if 'sux' in l:
raise Exception('python sux')
l['sux']=True
python_is_ok() # ok..
python_is_ok() # ok..
python_sux() # OK...
python_sux() # fail..
outputs:
do not sux
do not sux
Traceback (most recent call last):
File "sux.py", line 13, in <module>
python_sux() # fail..
File "sux.py", line 7, in python_sux
raise Exception('python sux')
Exception: python sux
Ok, ce comportement bizarre est indiqué dans le tutoriel de python, n'empeche que c'est louche.