Re: retain values between fun calls

2006-05-15 Thread bruno at modulix
Gary Wessle wrote: Hi the second argument in the functions below suppose to retain its value between function calls, the first does, the second does not and I would like to know why it doesn't? Fisrt thing to remember is that function's default args are eval'd only once - when the def

Re: retain values between fun calls

2006-05-14 Thread Kent Johnson
George Sakkis wrote: Gary Wessle wrote: Hi the second argument in the functions below suppose to retain its value between function calls, the first does, the second does not and I would like to know why it doesn't? and how to make it so it does? thanks # it does def f(a, L=[]):

retain values between fun calls

2006-05-13 Thread Gary Wessle
Hi the second argument in the functions below suppose to retain its value between function calls, the first does, the second does not and I would like to know why it doesn't? and how to make it so it does? thanks # it does def f(a, L=[]): L.append(a) return L print f('a') print f('b')

Re: retain values between fun calls

2006-05-13 Thread George Sakkis
Gary Wessle wrote: Hi the second argument in the functions below suppose to retain its value between function calls, the first does, the second does not and I would like to know why it doesn't? and how to make it so it does? thanks # it does def f(a, L=[]): L.append(a) return L