[issue11299] Allow deepcopying paused generators

Antoine Pitrou report at bugs.python.org
Sun Dec 8 20:59:02 CET 2013


Antoine Pitrou added the comment:

> The issue here is copy.deepcopy will raise an exception whenever it
> encounters a generator. We would like to do better here.
> Unfortunately, using itertools.tee is not a solution here because it
> does not preserve the type of the object.

Indeed, itertools.tee is not a general solution for copy.deepcopy, but
it's a good solution to *avoid* calling copy.deepcopy when you simply
want to "fork" a generator.

IMHO supporting live generators (and therefore frame objects) in
copy.deepcopy would be a waste of effort.

----------

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


More information about the Python-bugs-list mailing list