operator overloading

david_ullrich at my-deja.com david_ullrich at my-deja.com
Tue Jun 6 10:39:40 EDT 2000


In article <20000605235010.C469 at xs4all.nl>,
  Thomas Wouters <thomas at xs4all.net> wrote:
> On Mon, Jun 05, 2000 at 03:02:47PM -0700, Ken Seehof wrote:
>
> > The following more closely conforms to these conventions:
>
> The return code of __cmp__ is hardly a convention! If you dont return
one of
> those values, in a consistent manner, you're going to confuse the
users of
> your class greatly. And possibly break things like list.sort()'s
default
> sort function.

     This reminds me of a question that I've never got around
to asking: Are there implicit requirements on __cmp__, like
the order it defines has to be transitive, __cmp(a,b)__ has
to be the opposite of __cmp(b,a)__, etc?

DU


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list