[EMAIL PROTECTED] wrote: > (Accompanied by Marvin Gaye) > >>>> def f(list=[0]): > ... list[0]+=1 > ... return list[0] > ... >>>> f() > 1 >>>> f() > 2 >>>> f() # 'list' is a name bound to a list (mutable) so this makes sense > 3 >>>> f([5]) > 6 >>>>f() # What's Going On? > 4
That the same default argument is mutated? What did you expect, that it got replaced by you passing another list? That would kind of defy the meaning of default-arguments, replacing them whenever you call a function with actual parameters. Diez -- http://mail.python.org/mailman/listinfo/python-list