[Python-Dev] PEP 201 - Parallel iteration

Thomas Wouters thomas@xs4all.net
Wed, 19 Jul 2000 21:17:37 +0200


On Wed, Jul 19, 2000 at 02:48:20PM -0400, Barry A. Warsaw wrote:

> >>>>> "KY" == Ka-Ping Yee <ping@lfw.org> writes:
>     KY> (Ideally range(), zip(), and irange() would all make
>     KY> generators one day, and xrange() could be deprecated.)

> I agree!  So maybe what we need is a general generator type written in
> C.  Could the xrange type be subverted to this purpose?

Not likely. You'd have to write the assignment functions (changing the object
into a list-type if that is done) and most of the other stuff has to be
rewritten: almost all of xrange() is specific for PyInt's. It stores step,
start, end and repeater (for 'xrange * 10') as longs, and calculates return
values for getitem and repr and the like from those.

Other than a standard object boilerplate, it's pretty useless for more
generic generators.

-- 
Thomas Wouters <thomas@xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!