[Stackless] Problem with Count Objects (itertools) and pickle?

Andrew Dalke dalke at dalkescientific.com
Mon Nov 2 03:02:40 CET 2009


On Nov 2, 2009, at 2:46 AM, Andrew Francis wrote:
> Enclosed is a new version of pickle-sieve. I took Andrew Dalke's
> advice (it is good advice) and changed the following code
    ...
>     for i in itertools.count(2):
>         c.send(i)
>
> when I hit control C, I get the following error:
    ...
> TypeError: can't pickle count objects

Indeed! That was a bad suggestion of mine. itertools.count iterators  
(like many other types in Python) do not support pickling.

I didn't test it because of the other problem I had restoring from a  
pickled state.

> Is this meant to so?

I checked the source. count does not implement the pickling protocol.

Cheers.

				Andrew
				dalke at dalkescientific.com






More information about the Stackless mailing list