are user defined classes hashable?
Alan G Isaac
alan.isaac at gmail.com
Sun Jul 19 10:46:12 EDT 2009
> * Alan G Isaac <alan.isaac at gmail.com> [2009-07-19 13:48:16 +0000]:
>> Are user defined classes hashable?
>> (The classes; *not* the instances!)
>> I'm inclined to guess it will be hashed by id and this is
>> OK.
On 7/19/2009 10:07 AM Nicolas Dandrimont apparently wrote:
> You can check for yourself:
> In [1]: class Foo(object):
> ...: pass
> ...:
> In [2]: foo = Foo()
> In [3]: hash(foo)
> Out[3]: 15294992
> In [4]: id(foo)
> Out[4]: 15294992
Again, my question is about the class not its instances,
but still, checking as you suggest gives the same answer.
Thanks,
Alan
More information about the Python-list
mailing list