How to determine what called __cmp__ method?

Erik Max Francis max at alcyone.com
Sat Oct 21 02:30:31 EDT 2000


Pearu Peterson wrote:

> The question is how to determine inside __cmp__ method where it was
> called? That is I want to know was it called for evaluating
> either inequality '<', or '>', or '<=', or ...?

Why would you need to do that?  The purpose of the __cmp__ method is to
avoid such issues.  I submit that if you _really_ need to know which
operation was being requested, there's something wrong with either your
algorithm, your design, or both.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ If you are afraid of loneliness, do not marry.
\__/ Anton Chekhov
    7 sisters productions / http://www.7sisters.com/
 Web design for the future.



More information about the Python-list mailing list