[Oren Tirosh] > > Two strange things about xrange objects: > >>> 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? > > >>> dir(x) > [] > Shouldn't it have at least __class__, __repr__, etc and everything else > that object has? 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'] -- Patrick K. O'Brien Orbtech ----------------------------------------------- "Your source for Python software development." ----------------------------------------------- Web: http://www.orbtech.com/web/pobrien/ Blog: http://www.orbtech.com/blog/pobrien/ Wiki: http://www.orbtech.com/wiki/PatrickOBrien -----------------------------------------------
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