[Python-Dev] 'unhashable type' and new style classes
Jack Jansen
Jack.Jansen@oratrix.com
Mon, 30 Dec 2002 23:11:46 +0100
On maandag, dec 30, 2002, at 17:30 Europe/Amsterdam, Guido van Rossum
wrote:
> The default implementation of __hash__ must match the default
> implementation of __cmp__ (and rich comparisons, __eq__ etc.). So the
> default implementation cannot raise an exception, because objects are
> defined to be immutable by default. (Maybe this was a mistake, but
> it's not so easy to change without causing backwards
> incompatibilities.)
Is it an option to enforce that these methods are overridden together,
then? I.e. if you override any of them you must override all of them,
otherwise you get a warning?
--
- Jack Jansen <Jack.Jansen@oratrix.com>
http://www.cwi.nl/~jack -
- If I can't dance I don't want to be part of your revolution -- Emma
Goldman -