Hashability questions
alex23
wuwei23 at gmail.com
Mon May 14 21:35:36 EDT 2012
More information about the Python-list mailing list
Mon May 14 21:35:36 EDT 2012
- Previous message (by thread): Hashability questions
- Next message (by thread): Hashability questions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On May 14, 5:11 am, Bob Grommes <bob.grom... at gmail.com> wrote: > Obviously there is some sort of default implementation of __hash__() > at work and my implementation of _eq_() has somehow broken it. > Can anyone explain what's going on? It looks like this has changed between Python 2 and 3: "If a class does not define an __eq__() method it should not define a __hash__() operation either; if it defines __eq__() but not __hash__(), its instances will not be usable as items in hashable collections." From: http://docs.python.org/dev/reference/datamodel.html#object.__hash__ You should just be able to add a __hash__ to Utility and it'll be fine.
- Previous message (by thread): Hashability questions
- Next message (by thread): Hashability questions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list