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

Jeff Epler jepler at unpythonic.net
Thu Jun 17 08:09:29 EDT 2004


In addition to Dieter Maurer's suggestion to use the AST module, you
might have some success using decompyle or decompyle-like techniques.

When Python compiles
    e1 = 100 <= x
and
    e1 = x >= 100
it produces different bytecodes, one with COMPARE_OP <= and one with
COMPARE_OP >=.  It is in execution that Python determines that [in the
case of the first statement]
    (100).__le__(x)
is not implemented, and then calls
    x.__ge__(100)

Jeff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20040617/93bd7106/attachment.sig>


More information about the Python-list mailing list