I looks at what it would take to write proper hash functions. These
classes have ridiculously complicated equality operators. I am going to
throw a type error and any users who don't like it can bite me.

Thanks guys.

-----Original Message-----
From:
[EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
thon.org] On Behalf Of Alex Mohr
Sent: Tuesday, November 04, 2008 11:19 AM
To: Development of Python/C++ integration
Subject: Re: [C++-sig] mutable object has bogus __hash__

> 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
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to