Generators/iterators persistence
Tim Peters
tim.one at comcast.net
Tue May 20 12:35:10 EDT 2003
[Pawel Oleksik]
> Recently I'm working on some combinatoric algorithms and I
> found that it would have been quite useful if ther has been a
> possibilty of generators/iterators pickling.
>
> I know for my own classes I can ues a setstate--getstate protocol and
> I'm going to do that. But I guess it will be another level of
> complications and possibly will lead to (at least simply) bugs.
The same would be true if the system tried to do it for you, of course.
> So, there is an important question: is there or will be soon (P-2.3) any
> simple and efficient solution for generators/iterators persistence?
Sorry, there isn't, won't be in 2.3, and there are no plans in this
direction. The state of an iterator/generator can be arbitrarily complex,
potentially involving a giant web of code objects and execution frames
(neither of which can be pickled today), so there will never be a simple
solution. That's not to say I wouldn't like one too <wink>.
More information about the Python-list
mailing list