[Python-3000] ABC for Inequalities

Raymond Hettinger python at rcn.com
Tue Feb 12 04:31:14 CET 2008


[GvR]
> Hold on. We went down that road quite a bit and then discovered it
> wasn't going to work. 

I figured that it was missing for a reason.

> The problem is that if you have two instance x,
> y such that isinstance(x, TotalOrdering) and isinstance(y,
> TotalOrdering) you still don't know if x < y is defined. (For example,
> if x is a string and y is a number.) 

So, ordering only makes sense when "other" is known to be
of the same type as "self".

> There's a useful definition in there somewhere but
> it's elusive. We'll eventually figure it out.

I hope so. I'm less interested in the mixin and more interested in
a way for a class to have a way to tell you whether it is sortable.
Right now, the presence or absence of __le__ doesn't tell
you much.


Raymond


More information about the Python-3000 mailing list