[Patches] [ python-Patches-428320 ] rich comparisons as operator.__lt__ etc.

noreply@sourceforge.net noreply@sourceforge.net
Tue, 03 Jul 2001 22:53:19 -0700


Patches item #428320, was opened at 2001-05-29 07:58
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=428320&group_id=5470

Category: library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
>Assigned to: Fred L. Drake, Jr. (fdrake)
Summary: rich comparisons as operator.__lt__ etc.

Initial Comment:
Rich Comparisons (PEP 207) introduce new special names
in classes (__lt__, __le__, __eq__, etc.). They should
be available in the 'operator' module just like the
other special names (__add__ and the like).

This patch introduce 12 new names in 'operator': lt,
le, eq, ne, gt, ge, __lt__, __le__, __eq__, __ne__,
__gt__, __ge__. The first 6 are provided for uniformity
with the rest of the module but I am not sure whether
it is a good idea to clutter a namespace with names
only two letters long; for example, could names like
'eq' accidentally break existing programs using

  from operator import *

?


----------------------------------------------------------------------

>Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2001-07-03 22:53

Message:
Logged In: YES 
user_id=3066

I'd prefer to see the names that don't have underscores be
lessthan, lessthanequal, equal, notequal, greaterthan,
greaterthanequal.  Not sure what others think.  I doubt the
issue is "from operator import *" -- no one should be doing
that anyway.

Also, the documentation fragment uses "informations" (note
the 's') instead of "information".

----------------------------------------------------------------------

Comment By: Armin Rigo (arigo)
Date: 2001-05-29 08:01

Message:
Logged In: YES 
user_id=4771

Sorry, I forgot to login when I posted the patch.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=428320&group_id=5470