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

Balaji balaji at email.arizona.edu
Mon Jun 14 20:37:42 CEST 2004


Hello Everybody...

Let me try to explain what do I mean by "ordering importance".

In our application a expression 100>=x reads as 100 is an upper bound
on x. Mathematically it is same as saying x<=100 which also bounds x
by 100. But in modelling, the user wants to preserve the order in
which he has written the expression.

If the left side of an operand is an immutable type then this ordering
is no longer preserved, even if both the methods are implemented(i.e
__le__ and __ge__).

__radd__ allows you to have an immutable type on the left side. An
__rge__ method would provide the same functionality for relational
operators.

Is there a way to obtain this behavior with current syntax? 

Regards

Balaji



More information about the Python-list mailing list