[Python-Dev] Xrange and Slices
Thu, 27 Jun 2002 00:44:36 -0400
> The start, stop and step attributes to xrange would have to be
> revived (what was the idea behind removing them in the first place?)
A futile attempt at bloat reduction. At the time, there was more code in
Python to support unused xrange embellishments than there was to support
> >>> xrange(1,100,2)
> xrange(1, 101, 2)
> It's been there since at least Python 2.0. Hasn't anyone noticed this
> bug before?
It's been that way since xrange() was introduced, but nobody *called* it a
bug before. The two expressions are equivalent:
>>> list(xrange(1, 100, 2)) == list(xrange(1, 101, 2))
> So... why *isn't* slice == <type 'slice'>?
It is in current CVS Python, but still range != <type 'range'>, and won't
until someone cares enough to change it.