xrange not hashable - why not?

Hans Nowak hans at zephyrfalcon.org
Sun Jan 25 19:34:57 EST 2004


I wrote:

> Huh.  This is really weird:
> 
> (C:\) $ python22
> Python 2.2.2 (#37, Oct 14 2002, 17:02:34) [MSC 32 bit (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
>  >>> hash(xrange)
> 503376880

Um, duh...

 >>> hash(xrange(0))
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
TypeError: unhashable type

-- 
Hans (hans at zephyrfalcon.org)
http://zephyrfalcon.org/





More information about the Python-list mailing list