How to determine what called __cmp__ method?

Pearu Peterson pearu at cens.ioc.ee
Fri Dec 15 09:53:48 EST 2000


On Mon, 23 Oct 2000, Huaiyu Zhu wrote:

> In comp.lang.python, you (David A.) wrote:
> 
> >Now, with rich comparisons.. =)  (If anyone is interested in taking on the
> >work of creating the rich comparisons patches, pushing the PEP through,
> >etc., get in touch with me).
> 
> I'm interested in this, as I need it for numerical computation as well.  I
> thought I sent you an email before, which might be lost somewhere.
> Do you already have a draft of the PEP in any form?  Otherwise I can start
> an initial draft listing the features I have in mind, which may motivate
> others to add to it or even implement it.  

How is this PEP doing?

> Right now the main feature I have in mind is to allow partial orders, so
> that a!=b does not imply a<b or a>b.  I also want the comparison operators
> to have their own names, like __lt__, __ge__, for example.

What I am looking for is that __lt__, __ge__, and other related methods
are to be allowed to return arbitrary Python objects, not just Python
integers 0,1. Or is this already obvious requirement for rich comparions?

Pearu






More information about the Python-list mailing list