[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
http://effbot.org/pyfaq/why-are-default-values-shared-between-objects.htm You heard it through the grapevine ;) Peter -- http://mail.python.org/mailman/listinfo/python-list