Danny Yoo wrote:
Now I'm dizzy... I can't understand why there are two "L"!###
def f(a,L=[]):
if L==[5]:
print 'L==[5] caught'
print L
print 'resetting L...'
L=[]
L.append(a)
return L
###
L is a local variable of the function, right? (I can't imagine it being anything else) Then if I reassign L to something, why doesn't it keep that change till next run? At least, it keeps the values in the list.. so it should keep the reassignation, no?
I'm completly puzzled :-S
Ismael _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor