[Python-ideas] Automatic total ordering

Brandon Mintern bmintern at gmail.com
Thu Oct 16 00:05:50 CEST 2008


It seems like a lot of people are missing the idea that you *only*
need < (or >, <=, >=, with slightly different variations) for total
ordering on two objects of the same class, so here it is:

x < y
x > y -> y < x
x <= y --> not y < x
x >= y --> not x < y
x == y --> not x < y and not y < x
x != y --> x < y or y < x

At least, that's what I got from the original post,
Brandon



More information about the Python-ideas mailing list