Hash of class from instance
Steven Bethard
steven.bethard at gmail.com
Wed Feb 2 14:26:46 EST 2005
Mick Krippendorf wrote:
> In Python there seems to be no guarantee that different objects also
> have different hash values.
Well, it's true that you can override the __hash__ method to do whatever
you want, but I believe the default for class __hash__ methods is to
return the class id, which should be different for each class:
py> class C(object):
... pass
...
py> hash(C)
12699152
py> id(C)
12699152
Steve
More information about the Python-list
mailing list