[Python-bugs-list] [ python-Bugs-730087 ] new-style classes with just __eq__ hashable

SourceForge.net noreply@sourceforge.net
Wed, 30 Apr 2003 02:26:35 -0700


Bugs item #730087, was opened at 2003-04-30 09:59
Message generated for change (Comment added) made by mwh
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=730087&group_id=5470

Category: Python Interpreter Core
Group: Python 2.3
>Status: Closed
>Resolution: Duplicate
Priority: 5
Submitted By: Michael Hudson (mwh)
Assigned to: Guido van Rossum (gvanrossum)
Summary: new-style classes with just __eq__ hashable

Initial Comment:
Forgive me if the rules changed somewhere without me
knowing, but:

/>> class C(object): # new style
|..  def __eq__(self, other):
|..   return 1
\__ 
->> hash(C())
137007476
/>> class C: # old-style
|..  def __eq__(self, other):
|..   return 1
\__ 
->> hash(C())
Traceback (most recent call last):
  File "<input>", line 1, in ?
TypeError: unhashable instance

This would seem to be quite bad.

----------------------------------------------------------------------

>Comment By: Michael Hudson (mwh)
Date: 2003-04-30 10:26

Message:
Logged In: YES 
user_id=6656

This is actually the same issue as bug #660098.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=730087&group_id=5470