Was: Is this an Bug in python 2.3?? Reflective relational operators

Leo leo at sie.arizona.edu
Wed Jun 16 03:04:27 CEST 2004

> The comparison operators should be used in cases where the "reflective" 
> behaviour is sound. I beleive they should not be used for other things 
> than comparing instances for witch there is a complete order (many 
> others will disagree).

I don't immediately see why we should restrict the usage of comparison
operators to that case, but that doesn't matter. What (maybe) matters
is: If we were to ask (PEP) for an __rge__ with a default
implementation that calls __le__ with the parameters inverted, would
that break anything?

I can think of other applications where this would be useful. For
example: generating MathML from python expressions. Or looking at it
another way, wouldn't it improve language consistency to add an
__rge__ method?

Unfortunately in PEP 207 the issue of reflexivity is raised and
decided, but not justified. Maybe at the time no one had an example
where this feature would be useful? Would it be too hard to change?


More information about the Python-list mailing list