[Python-Dev] Rich comparison confusion
Guido van Rossum
Fri, 19 Jan 2001 11:00:30 -0500
> Yes, the "inverse" is confusing. Is what you mean the "reverse" ?
> Like the other right-side operators __radd__, is it correct to
> think of
> __ge__ == __rle__
> if __rle__ was written in the same fashion like __radd__ ?
> It looks semantically the same, although the reason for a
> call might be different.
Yes, it's semantically the same, and the reason for the call is the
same too ("the left argument doesn't support the operator so let's try
if the right one knows").
> And if my above view is right, would it perhaps be less
> confusing to use in fact __rle__ and __rlt__,
> or woudl it be more confusing, since __rlt__ would also be
> invoked left-to-right, implementing ">".
I prefer 6 new operators over 12 any day. I can see no valid reason
why someone would want to overload a>b different than b<a, while
there are plenty of reasons why a+b and b+a should be different:
e.g. string concatenation.
--Guido van Rossum (home page: http://www.python.org/~guido/)