[Python-Dev] Why should the default hash(x) == id(x)?

Josiah Carlson jcarlson at uci.edu
Sun Nov 6 01:19:49 CET 2005


Noam Raphael <noamraph at gmail.com> wrote:
> 
> On 11/5/05, "Martin v. Löwis" <martin at v.loewis.de> wrote:
> > More generally, I claim that the current behaviour is better than
> > *any* alternative. To refute this claim, you would have to come
> > up with an alternative first.
> >
> The alternative is to drop the __hash__ method of user-defined classes
> (as Guido already decided to do), and to make the default __eq__
> method compare the two objects' __dict__ and slot members.
> 
> See the thread about default equality operator - Josiah Carlson posted
> there a metaclass implementing this equality operator.

The existance of a simple equality operator and metaclass is actually a
strike against changing the default behavior for equality.

 - Josiah



More information about the Python-Dev mailing list