Raymond Hettinger <raymond.hettin...@gmail.com> added the comment:

The dict iterators depend on the order of the dict being the same when 
unpickled on another python (the order will vary depending on dummy entries, 
insertion order, 32 vs 64 bit builds, salted hashes, etc).  Sets have the same 
issue -- it doesn't seem possible to pickle a set iterator in a "semi-consumed 
state" without being able to reproduce the underlying unordered collection in 
*exactly* the same order and being able to point the resumed iterators to the 
correct part of memory.  Any hacks to make this appear to work would like be 
hard to reproduce across different implementations of Python (i.e. Jython's 
dicts are based on Java's concurrent mappings).

There isn't a provision for saving and restoring running generators.

There isn't a provision for iterators created using iter(func, sentinel) where 
successive func calls change state.

I don't see how str iterators remember where they left off.

Note, the prior effort to make iterators copyable was a failure.  It was 
difficult to do in the general case and the cases we did provide had zero 
uptake (i.e. they were never used).  ISTM, that pickling iterators faces the 
same issues.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue14288>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to