[issue2561] Instance remembers old values from former life

2008-04-06 Thread Werner Arnhold
New submission from Werner Arnhold [EMAIL PROTECTED]: I don't know if it is a bug or a feature but the result seems to be wrong for me: A constructor argument remembers its values from the last call -- files: class_with_listparamdefault.py messages: 65024 nosy: warnhold severity: normal

[issue2561] Instance remembers old values from former life

2008-04-06 Thread Georg Brandl
Georg Brandl [EMAIL PROTECTED] added the comment: Yes, this is expected. Default values are only evaluated once, at function creation time. If you need to have a mutable default argument that is assigned to something and changed, use something like this: def f(arg=None): if arg is None: