Message156749
| Author |
sbt |
| Recipients |
georg.brandl, jcea, kristjan.jonsson, loewis, michael.foord, pitrou, rhettinger, sbt |
| Date |
2012年03月25日.11:40:22 |
| SpamBayes Score |
0.0009308451 |
| Marked as misclassified |
No |
| Message-id |
<1332675624.63.0.519361736684.issue14288@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
> ... 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. |
|