[Python-Dev] Xrange and Slices

Oren Tirosh oren-py-d@hishome.net
Wed, 26 Jun 2002 21:30:59 +0300


On Wed, Jun 26, 2002 at 08:49:26AM -0500, Patrick K. O'Brien wrote:
> What is x in your example? Assuming x == xrange, I get this with Python
> 2.2.1:
> 
> >>> dir(xrange)
> ['__call__', '__class__', '__cmp__', '__delattr__', '__doc__',
> '__getattribute__', '__hash__', '__init__', '__name__', '__new__',
> '__reduce__', '__repr__', '__self__', '__setattr__', '__str__']
> 
> Assuming x == xrange(1, 100, 2):
> 
> >>> x = xrange(1, 100, 2)
> >>> dir(x)
> PyCrust-Shell:1: DeprecationWarning: xrange object's 'start', 'stop' and
> 'step' attributes are deprecated
> ['start', 'step', 'stop', 'tolist']

It's the latter (xrange instance, not the type).

I'm getting an empty dir() in the latest CVS version.  The result you got 
is what happens in 2.2 and 2.2.1.

	Oren