[Python-Dev] xrange vs generators

Thomas Heller thomas.heller@ion-tof.com
Mon, 25 Jun 2001 17:05:09 +0200


> [theller]
> > I _was_ using xrange as sets representing (potentially large)
> > ranges of ints.
> > Example:
> > 
> > positive = xrange(1, sys.maxint)
> > 
> > if num in positive:
> >    ...
> > 
> > I didt follow the iterators discussion: would this
> > continue to work?
> 
> No, it would break.
Since there was a off-by-one bug for 'if num in xrange()'
in Pyhon2.0 my code already has been rewritten.

Thomas