[issue3958] strage default value behaviour
Amaury Forgeot d'Arc
report at bugs.python.org
Wed Sep 24 17:58:27 CEST 2008
Amaury Forgeot d'Arc <amauryfa at gmail.com> added the comment:
Your script is subject to the "shared default value" syndrome, explained
here:
http://www.python.org/doc/faq/general/#why-are-default-values-shared-between-objects
As indicated in the FAQ, your function could be rewritten like this:
def getElementsByAttrib(self, value, AName="ID-REF", list=None):
if list is None:
list = []
...
to have a less surprising behavior.
----------
nosy: +amaury.forgeotdarc
resolution: -> invalid
status: open -> closed
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3958>
_______________________________________
More information about the Python-bugs-list
mailing list