[Python-Dev] Re: Proposed iterator representations

Terry Reedy tjreedy at udel.edu
Fri Apr 9 14:23:15 EDT 2004


"Raymond Hettinger" <python at rcn.com> wrote in message
news:000b01c41ddb$94296280$0507a044 at oemcomputer...
> I checked in two itertool representations that were clear-cut:

;-)

> >>> from itertools import count, repeat
> >>> count(20)
> count(20)

Is the representation (of the dynamic object) static?  Does

it=count(20); it.next(), it.next(); it

still print 'count(20)' as it one was but no longer is?

This seems much like lt=iter([1,2,3]); lt.next(); lt.next(); lt printing
iter([1,2,3]) instead of iter([3]), or worse, lt=[1,2,3]; lt.pop();
lt.pop(); lt printing [1,2,3] instead of [1].

Terry J. Reedy






More information about the Python-Dev mailing list