* Paul McGuire wrote: >> py> def __init__(self, arg = []): >> py> self.__list = arg > > Please don't perpetuate this bad habit!!! "arg=[]" is evaluated at > compile time, not runtime, and will give all default-inited llists the > same underlying list.
While this actually might be bad habit, the default arguments are *not* eval'd at compile time. This seems to be a common mistake. They are evaluated at runtime as everything else. The difference to other local variables is, that the objects they're referring to are just initalized once instead of each time they're taken into account. nd -- die (eval q-qq[Just Another Perl Hacker ] ;-) # André Malo, <http://pub.perlig.de/> # -- http://mail.python.org/mailman/listinfo/python-list