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/025977.html below:

[Python-Dev] Xrange and Slices

[Python-Dev] Xrange and SlicesOren Tirosh oren-py-d@hishome.net
Thu, 27 Jun 2002 03:00:53 -0400
On Thu, Jun 27, 2002 at 12:44:36AM -0400, Tim Peters wrote:
> > >>> 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

I found that seconds after hitting 'y'...

> [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.

There is no spoo^H^H^H^H <type 'range'>.  
xrange is <type 'xrange'> and range is <built-in function range>.

	Oren





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