What methods do you need to override / implement when creating custom classes that are sortable and / or hashed in python?
Why do we need sentries?
I type dir({}) in my interpreter to get a list of methods on inline dicts. Of these, I assume that I need some to implement some subset
['__cmp__', '__eq__', '__ge__', '__gt__', '__hash__', '__le__', '__lt__', '__ne__']
Is there a difference in which methods should be implemented for Python3, not Python2?
python sorting class magic-methods hash
Matt Fenwick Aug 22 '11 at 19:25 2011-08-22 19:25
source share