PEP 234: Iterators

Bernhard Herzog bh at intevation.de
Sat May 5 13:26:03 EDT 2001


aahz at panix.com (Aahz Maruch) writes:

> In article <nfiI6.83$Yu6.16482 at newsc.telia.net>,
> Fredrik Lundh <fredrik at effbot.org> wrote:
> >Aahz Maruch wrote:
> >> Well, yes.  The whole point of this exercise is that xrange() will be
> >> essentially deprecated in 2.2.  There's no more need to create any
> >> new x*() functions.
> >
> >what should you use instead of xrange?
> 
> range() -- at least, I'm assuming that range() will return an iterator
> in the appropriate contexts.

But how does range know in what context it's being called? range is
documented as returning a list and I wouldn't be surprised if there were
code that made use of that fact (in fact there's a place in Sketch where
that fact is used).

  Bernhard

-- 
Intevation GmbH                                 http://intevation.de/
Sketch                                 http://sketch.sourceforge.net/
MapIt!                                               http://mapit.de/



More information about the Python-list mailing list