[Python-Dev] Xrange and Slices

Greg Ewing greg@cosc.canterbury.ac.nz
Thu, 27 Jun 2002 14:38:12 +1200 (NZST)

Oren Tirosh <oren-py-d@hishome.net>:

> Since xrange is the one more commonly used in everyday 
> programming I'd say that slice should be an alias to xrange, not the other
> way around.

I was about to yell "No, don't do that, slice is a type!"
when I decided I'd better make sure that's true...
and found that it's NOT!

Python 2.2 (#14, May 28 2002, 14:11:27) 
[GCC 2.95.2 19991024 (release)] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> slice
<built-in function slice>
>>> s = slice(1,2,3)
>>> s.__class__
<type 'slice'>

So... why *isn't* slice == <type 'slice'>?

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg@cosc.canterbury.ac.nz	   +--------------------------------------+