
July 24, 2016
12:54 a.m.
On Sun, Jul 24, 2016 at 10:15 AM, Guido van Rossum <gvanrossum@gmail.com> wrote:
Does it work? For what categories of iterators? Surely not for streams...
I tried it with list and set iterators and it worked fine. With a generator, it threw an exception (though not something tidy like UncopyableObjectException - it complained about calling object.__new__(generator) instead of generator.__new__). Presumably it'll fail, one way or another, with non-duplicable objects (eg an open file, which is its own iterator, simply raises TypeError "cannot serialize"); those are non-restartable, non-bookmarkable, non-forkable iterators (take your pick of terminology). ChrisA