MacPython Logo from __future__ import *

buy music albums Silver Apples buy mp3 albums Tarrus Riley buy tracks mp3 Kravits buy Reaper albums mp3 buy Kravits albums music buy music Evita CD online albums mp3 Silver Apples download Madonna CD music buy tracks music Kravits download music albums Silver Apples

2004-01-25

pickle those iterators

Filed under: python, stackless — bob @ 2:32 pm

I made a small patch to the Stackless 2.3 branch today: iterator pickling. It now pickles/unpickles all of the private iterator types (that I know of) in Python's builtins: dictionary-iterator, listiterator, rangeiterator, tupleiterator. I'm sure it will be in CVS pretty soon.

Python 2.3.3 Stackless 3.0 040119 (#5, Jan 25 2004, 11:26:07) 
[GCC 3.3 20030304 (Apple Computer, Inc. build 1495)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from pickle import loads, dumps
>>> a = iter(range(10))
>>> a
<stackless.listiterator object at 0x3d0d50>>>> a.next()
0
>>> a.next()
1
>>> b = loads(dumps(a)) 
>>> a.next()
2
>>> b.next()
2

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

WP-Hashcash: protecting you from spam.

Powered by WordPress