[ python-Bugs-1682729 ] Documentation error (section 3.4.1)

SourceForge.net noreply at sourceforge.net
Sat Mar 17 16:40:35 CET 2007


Bugs item #1682729, was opened at 2007-03-17 15:03
Message generated for change (Comment added) made by zseil
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1682729&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Documentation
Group: None
>Status: Closed
>Resolution: Invalid
Priority: 5
Private: No
Submitted By: emlyn (emlyncorrin)
Assigned to: Nobody/Anonymous (nobody)
Summary: Documentation error (section 3.4.1)

Initial Comment:
In the documentation section 3.4.1 Basic customization (url: http://docs.python.org/ref/customization.html) it states:

There are no reflected (swapped-argument) versions of these methods (to be used when the left argument does not support the operation but the right argument does); rather, __lt__() and __gt__() are each other's reflection, __le__() and __ge__() are each other's reflection, and __eq__() and __ne__() are their own reflection.

Surely that should be __lt__() and __ge__() are each other's reflection, and __le__() and __gt__(). I assume this is just a typo, but I haven't checked that Python itself gets it right.

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

>Comment By: Žiga Seilnacht (zseil)
Date: 2007-03-17 16:40

Message:
Logged In: YES 
user_id=1326842
Originator: NO

No, the documentation is correct (as well as Python's
behaviour). For example, you have a left_five and right_five,
which are int like objects with value 5, and left_five is
missing a __lt__ method. If you do a left_five < right_five
comparison, you want right_five's __gt__ method called,
because right_five's __ge__ method would return True,
since their values are equal.

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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1682729&group_id=5470


More information about the Python-bugs-list mailing list