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/2008-December/084425.html below:

[Python-Dev] Py3k: magical dir()

[Python-Dev] Py3k: magical dir()Dmitry Vasiliev dima at hlabs.spb.ru
Fri Dec 19 15:20:55 CET 2008
Hello!

I think it's a strange behavior:

Python 3.1a0 (py3k:67851, Dec 19 2008, 16:50:32)
[GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> hash(range(10))
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
TypeError: unhashable type: 'range'
 >>> dir(range(10))
['__class__', '__delattr__', '__doc__', '__eq__', '__format__', 
'__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', 
'__init__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', 
'__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', 
'__setattr__', '__sizeof__', '__str__', '__subclasshook__']
 >>> hash(range(10))
-1211318616
 >>> hash(range(1000))
-1211318472

-- 
Dmitry Vasiliev (dima at hlabs.spb.ru)
   http://hlabs.spb.ru
More information about the Python-Dev mailing list

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