"Guido van Rossum" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
| But can this work? It might end up calling cmp() on two incomparable
| objects. For __lt__ etc. that might be the right answer, but for
| __eq__ it is *not* -- the default __eq__ and __ne__ *must* compare
| object identity.

Sorry, leave them out then unless using a mixin.  I was responding to 
Colin's wish that people be able to write one __cmp__ method instead of six 
and thinking about something like what Steven uses but based on __cmp__ 
instead of__key__.  I am not thinking of any use cases at the moment could 
imagine this instead being a cookbook recipe.  Or something to consider if 
there is substantantial objection to the demise of cmp as a alternative to 
keeping it.  But maybe there will not be.

| (What is this __cmp you refer to? A typo for __cmp__ or for cmp?)

A substitute private name for __cmp__ if the latter is to be deprecated 
(and warned about).

Terry Jan Reedy



_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to