xrange not hashable - why not?

Hans Nowak hans at zephyrfalcon.org
Mon Jan 26 01:34:57 CET 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