I would like to have the __hash__ not exist. These objects are mutable and should NOT be used as keys. Is there a way to hide it? If I have them throw NotImplemented will python do something sensible with that?

Python raises a TypeError for unhashable things:

>>> [1,2,3].__hash__()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: list objects are unhashable

(You get the same with hash([1,2,3]) of course.)

Alex
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to