[Python-Dev] Py3k: magical dir() (original) (raw)
Guilherme Polo ggpolo at gmail.com
Fri Dec 19 16:23:55 CET 2008
- Previous message: [Python-Dev] Py3k: magical dir()
- Next message: [Python-Dev] Py3k: magical dir()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Fri, Dec 19, 2008 at 12:20 PM, Dmitry Vasiliev <dima at hlabs.spb.ru> wrote:
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 "", line 1, in 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', 'reduceex', 'repr', 'reversed', 'setattr', 'sizeof', 'str', 'subclasshook'] hash(range(10)) -1211318616 hash(range(1000)) -1211318472
There are other ways to reproduce it without using dir, like range(10).class; hash(range(10))
Is there some reason no set tp_hash for rangeobject to PyObject_HashNotImplemented ?
-- Dmitry Vasiliev (dima at hlabs.spb.ru) http://hlabs.spb.ru
-- -- Guilherme H. Polo Goncalves
- Previous message: [Python-Dev] Py3k: magical dir()
- Next message: [Python-Dev] Py3k: magical dir()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]