A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-June/025976.html below:

[Python-Dev] Xrange and Slices

[Python-Dev] Xrange and SlicesTim Peters tim.one@comcast.net
Thu, 27 Jun 2002 00:44:36 -0400
[Oren Tirosh]
> ...
> 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
generators.

> ...
> >>> 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))
True
>>>

[Greg Ewing]
> ...
> 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.





RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4