I have a bunch of classes in c++ with operator== defined, and I exported
it as __eq__. They apparently inherited object's __hash__ .  All was
well until my users started to put these objects in sets and use them as
dict keys. Objects that have the compare equal do not have the same
hash. This causes weirdness and errors. 

 

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? 

 

I suppose the other thing I could do is come up with some bull---- hash
function, but I would rather not. The objects really do not belong in
sets or dict keys.  

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

Reply via email to