On Monday, May 14, 2012 8:35:36 PM UTC-5, alex23 wrote: > 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.
Thanks, Alex. I should have mentioned I was using Python 3. I guess all this is a bit over-thought to just crank out some code -- in practice, comparing two classes for equality is mostly YAGNI -- but it's my way of coming to a reasonably in-depth understanding of how things work ... -- http://mail.python.org/mailman/listinfo/python-list
