sbt <shibt...@gmail.com> added the comment:

> ... and that pickling things like dict iterators entail running the 
> iterator to completion and storing all of the results in a list.

The thing to emphasise here is that pickling an iterator is "destructive": 
afterwards the original iterator will be "empty".

I can't think of any other examples where pickling an object causes non-trivial 
mutation of that object.

Come to think of it, doesn't copy.copy() delegate to 
__reduce__()/__reduce_ex__().  It would be a bit surprising if 
copy.copy(myiterator) were to consume myiterator.  I expect copy.copy() to 
return an independent copy without mutating the original object.

----------

_______________________________________
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