Function attributes: a bug?
Jeff Epler
jepler at unpythonic.net
Sun Mar 30 17:42:48 EST 2003
Unfortunately, pychecker does not currently detect this mistake. However,
it will detect it when nested scopes are not used:
1 def f(arg=[]):
2 arg.append("zyxxy")
mutabledefarg.py:2: Modifying parameter (arg) with a default value may have
unexpected consequences
The "bug" has nothing to do with function attributes, as many others have
pointed out already.
Jeff
More information about the Python-list
mailing list