[issue6637] non-empty defaultdict .copy() fails returning empty dict

Tom Clarke report at bugs.python.org
Tue Aug 4 11:50:50 CEST 2009


Tom Clarke <t.clarke at ic.ac.uk> added the comment:

NB - (discussion of significance of this bug)

Defaultdict called with no argument is anomalous & this problem can be 
avoided in such cases by using dict. However this is not possible if 
default value can change and the documentation specifically defines 
behavior when called with no parameter, so this case is allowed.

Furthermore this bug is unpleasant because when the default values are 
never used it is very counterintuitive to imagine that the an error in 
the default value function could have any effect on the output.

Possible solutions:
(1) raise error in this case, change documentation (I prefer)
(2) mend behaviour in this case

Best wishes, Tom

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6637>
_______________________________________


More information about the Python-bugs-list mailing list