[issue14288] Make iterators pickleable

Kristján Valur Jónsson report at bugs.python.org
Wed Mar 14 18:31:00 CET 2012


Kristján Valur Jónsson <kristjan at ccpgames.com> added the comment:

another trick has been suggested.  For hidden iterator objects, such as stringiter, to actually put them in the "types" module.
in there, we could do something like:
#types.py
stringiter = iter('').__class__

and we would then change the name of the iterator in c to be "types.stringiter".

How does that sound?  It _does_ make it necessary for the types module to be there to help with pickling.  The _proper_ fix would be for e.g. stringiter to live in builtins, next to 'str' that it is iterating over.  Any thoughts?

----------

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


More information about the Python-bugs-list mailing list