[issue12422] When deepcopying, don't store immutable objects in the memo dict

Alex Gaynor report at bugs.python.org
Mon Jun 27 20:34:52 CEST 2011


Alex Gaynor <alex.gaynor at gmail.com> added the comment:

Amaury points out: this is not strictly about immutable objects, but rather objects who's deepcopy is themselves (identity-wise), in some (rare I think) cases this could provide a slowdown.  Specifically a case of [(1, 2, 3)] * 10000 would be slower, because it would review each tuple individually, rather than using the memo'd instance.  I suspect this case is not so common (to have the same identity object, who's deepcopy is itself such as a tuple or object with custom __deepcopy__, many times in a deepcopy object graph), but I have no proof of this.

----------

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


More information about the Python-bugs-list mailing list