Comparisons and sorting of a numeric class....

Ian Kelly ian.g.kelly at
Fri Jan 23 19:13:26 CET 2015

On Fri, Jan 23, 2015 at 10:45 AM, Rustom Mody <rustompmody at> wrote:
> No disagreement with the 'hack'
> As for "no use case for equal but distinct tokens" - thats a strange
> view given this thread

If you want equal but distinct, you can give them distinct values and
define an __eq__ method that compares them as equal. Because of this
though I do take some issue with the Planet example in the docs:

If any planets happened to have the same mass and radius (which I
realize would be unlikely in this case), the example would fail. Using
the value of the enum for both identity and data conflates the two
concepts and leads to pitfalls.

More information about the Python-list mailing list