[Python-Dev] Rich comparison confusion
Thu, 18 Jan 2001 22:39:18 +0100
Guido van Rossum wrote:
> > I'm a bit confused about Guido's rich comparison stuff. In the description
> > he states that __le__ and __ge__ are inverses as are __lt__ and __gt__.
> Yes. By this I mean that A<B and B>A are interchangeable, ditto for
> A<=B and B>=A. Also A==B interchanges for B==A, and A!=B for B!=A.
> I think what threw you off was the ambiguity of "inverse". This means
> Boolean negation. I'm not relying on Boolean negation here -- I'm
> relying on the more fundamental property that a<b and b>a have the
> same outcome.
Yes, the "inverse" is confusing. Is what you mean the "reverse" ?
Like the other right-side operators __radd__, is it correct to
__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.
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 ">".
Not shure if I added even more confusion.
Christian Tismer :^) <mailto:firstname.lastname@example.org>
Mission Impossible 5oftware : Have a break! Take a ride on Python's
Kaunstr. 26 : *Starship* http://starship.python.net
14163 Berlin : PGP key -> http://wwwkeys.pgp.net
PGP Fingerprint E182 71C7 1A9D 66E9 9D15 D3CC D4D7 93E2 1FAE F6DF
where do you want to jump today? http://www.stackless.com