[issue11299] Allow deepcopying paused generators

Bastien Montagne report at bugs.python.org
Sun Dec 8 21:23:26 CET 2013


Bastien Montagne added the comment:

Yes, itertools.tee just keep in memory elements produced by the "most advanced" iterator, until the "least advanced" iterator consumes them. It may not be a big issue in most cases, but I can assure you that when you have to iter several times over a million of vertices, this is not a good solution… ;)

Fortunately, in this case I can just produce several times the same generator, but still, would be nicer (at least on the “beauty of the code” aspect) if there was a way to really duplicate generators.

Unless I misunderstood things, and deepcopying a generator would imply to also copy its whole source of data?

----------

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


More information about the Python-bugs-list mailing list