are user defined classes hashable?
Hyuga
hyugaricdeau at gmail.com
Mon Jul 20 11:52:39 EDT 2009
On Jul 19, 11:39 am, Nicolas Dandrimont <Nicolas.Dandrim... at crans.org>
wrote:
> * Alan G Isaac <alan.is... at gmail.com> [2009-07-19 14:46:12 +0000]:
>
> > Again, my question is about the class not its instances,
> > but still, checking as you suggest gives the same answer.
>
> That's what I get for answering before my coffee!
Regardless, Nicolas's example can be applied to the class too:
>>> class Foo(object):
pass
>>> hash(Foo)
11443104
>>> id(Foo)
11443104
class objects are just objects of type 'type'.
More information about the Python-list
mailing list