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

Andrew Francis andrewfr_ice at yahoo.com
Mon Nov 2 02:46:14 CET 2009


Hello Folks:

Enclosed is a new version of pickle-sieve. I took Andrew Dalke's
advice (it is good advice) and changed the following code

def counter(c):
    i = 2
    while (True):
        c.send(i)
        i += 1

to 

def counter(c):
    for i in itertools.count(2):
        c.send(i)

when I hit control C, I get the following error:

Traceback (most recent call last):
  File "pickle-sieve-new.py", line 110, in <module>
    pickle.dump(image, fd)
  File "/usr/local/lib/python2.6/copy_reg.py", line 70, in _reduce_ex
    raise TypeError, "can't pickle %s objects" % base.__name__
TypeError: can't pickle count objects

Is this meant to so?

Cheers,
Andrew


      
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pickle-sieve-new.py
Type: text/x-python-script
Size: 2763 bytes
Desc: not available
URL: <http://www.stackless.com/pipermail/stackless/attachments/20091101/74c7fddd/attachment.bin>


More information about the Stackless mailing list