You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add an easy way to provide total ordering now that __cmp__ is deprecated/gone #49729
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee='https://github.com/rhettinger'closed_at=<Date2010-08-08.01:19:51.952>created_at=<Date2009-03-12.08:18:35.996>labels= ['type-feature', 'library', 'docs']
title='Add an easy way to provide total ordering now that __cmp__ is deprecated/gone'updated_at=<Date2010-08-08.01:19:51.951>user='https://bugs.python.org/mrts'
That's the best version I recall seeing at activestate.
Still, I'd deprecate and remove > and >= from mathematics.
loewis commented on Mar 12, 2009
loewismannequin
Mannequin
More actions
What is the purpose of this submission? What do you want to happen about
Python?
lambertdw commented on Mar 12, 2009
lambertdwmannequin
Mannequin
More actions
(As I recall) in python-dev mailing list Ray claimed he could clean up a
cited active state recipe to address this issue. He succeeded to the
extent I'm aware---he's the author of http://code.activestate.com/recipes/576685/.
I haven't used the redundant >, >= comparisons operators in code since
1981. The chances of simplifying python by removing them from the
language are None, but the mistake predates python by 10**n years, where
(3 <= n <= 7) or (7 >= n >= 3).
loewis commented on Mar 12, 2009
loewismannequin
Mannequin
More actions
Then why was this classified as a documentation issue? And why did Mart
Sömmermaa submit it, and not Raymond? AFAICT, Raymond said he would
propose something when it's ready (which I assume it currently isn't).
mrts commented on Mar 13, 2009
mrtsmannequin
MannequinAuthor
More actions
Then why was this classified as a documentation issue?
And why did Mart Sömmermaa submit it, and not Raymond? AFAICT, Raymond
said he would propose something when it's ready (which I assume it
currently isn't).
Raymond's recipe at http://code.activestate.com/recipes/576685/ looks
more or less complete, do you feel that his posting on the mailing list
does not count as proposal? I submitted the feature request instead of
him because I was the one who noticed the problem (as discussed on the
mailing list) and felt "responsible" to report it here.
Raymond's recipe at http://code.activestate.com/recipes/576685/ looks
more or less complete, do you feel that his posting on the mailing list
does not count as proposal? I submitted the feature request instead of
him because I was the one who noticed the problem (as discussed on the
mailing list) and felt "responsible" to report it here.
When functools.total_ordering (whether it lands in functools is open)
lands that section should be amended in the lines of the following:
"There are no implied relationships among the comparison operators. The
truth of x==y does not imply that x!=y is false. Accordingly, when
defining __eq__(), one should also define __ne__() so that the operators
will behave as expected.
However, given a class defining one or more ordering methods, functools.total_ordering_ class decorator can be used to fill in the
rest. Please see the documentation of functools.total_ordering_ for
further details."
Small documentation question: Does the expression “total ordering” have established usage in maths or computer science? Its meaning is not obvious to the non-maths person that I am.
For pair of items from a set, (that's the total)
if a <= b and b <= c then a <= c (part of the order)
if a <= b and b <= a then a compares the same as b, a == b, (the
other part of the order)
On Mon, 2010-04-05 at 19:46 +0000, Éric Araujo wrote:
Small documentation question: Does the expression “total ordering” have established usage in maths or computer science? Its meaning is not obvious to the non-maths person that I am.
Activity
mrts commentedon Mar 12, 2009
See http://mail.python.org/pipermail/python-dev/2009-March/087000.html
and http://code.activestate.com/recipes/576685/ .
lambertdw commentedon Mar 12, 2009
That's the best version I recall seeing at activestate.
Still, I'd deprecate and remove > and >= from mathematics.
loewis commentedon Mar 12, 2009
What is the purpose of this submission? What do you want to happen about
Python?
lambertdw commentedon Mar 12, 2009
(As I recall) in python-dev mailing list Ray claimed he could clean up a
cited active state recipe to address this issue. He succeeded to the
extent I'm aware---he's the author of
http://code.activestate.com/recipes/576685/.
I haven't used the redundant >, >= comparisons operators in code since
1981. The chances of simplifying python by removing them from the
language are None, but the mistake predates python by 10**n years, where
(3 <= n <= 7) or (7 >= n >= 3).
loewis commentedon Mar 12, 2009
Then why was this classified as a documentation issue? And why did Mart
Sömmermaa submit it, and not Raymond? AFAICT, Raymond said he would
propose something when it's ready (which I assume it currently isn't).
mrts commentedon Mar 13, 2009
As the documentation section of
http://docs.python.org/reference/datamodel.html#object.\_\_lt__ needs to
be updated as well to mark the eventual solution as the recommended easy
way to provide total ordering.
Raymond's recipe at http://code.activestate.com/recipes/576685/ looks
more or less complete, do you feel that his posting on the mailing list
does not count as proposal? I submitted the feature request instead of
him because I was the one who noticed the problem (as discussed on the
mailing list) and felt "responsible" to report it here.
loewis commentedon Mar 13, 2009
This is the 2.6 version. What about the 3.0 version in
http://docs.python.org/3.0/reference/datamodel.html#object.\_\_lt__
needs to be updated?
I see. So it's a feature request.
mrts commentedon Mar 14, 2009
When functools.total_ordering (whether it lands in functools is open)
lands that section should be amended in the lines of the following:
"There are no implied relationships among the comparison operators. The
truth of x==y does not imply that x!=y is false. Accordingly, when
defining __eq__(), one should also define __ne__() so that the operators
will behave as expected.
However, given a class defining one or more ordering methods,
functools.total_ordering_ class decorator can be used to fill in therest. Please see the documentation of
functools.total_ordering_ forfurther details."
rhettinger commentedon Apr 4, 2010
See r79730.
Leaving open until tests are written and all is forward ported to 3.2.
merwok commentedon Apr 5, 2010
Hello
Small documentation question: Does the expression “total ordering” have established usage in maths or computer science? Its meaning is not obvious to the non-maths person that I am.
Regards
mdickinson commentedon Apr 5, 2010
Yes, it's a standard mathematics term.
http://en.wikipedia.org/wiki/Total_order
rhettinger commentedon Apr 5, 2010
http://en.wikipedia.org/wiki/Total_order
merwok commentedon Apr 5, 2010
Thanks for the link. Please include it in the future doc if you judge it useful for a large number of users.
I’m still wondering if “total_ordering” is the best name for a decorator that fills the blanks to provide total ordering.
Regards
lambertdw commentedon Apr 5, 2010
http://en.wikipedia.org/wiki/Total_order
For pair of items from a set, (that's the total)
if a <= b and b <= c then a <= c (part of the order)
if a <= b and b <= a then a compares the same as b, a == b, (the
other part of the order)
On Mon, 2010-04-05 at 19:46 +0000, Éric Araujo wrote:
rhettinger commentedon Aug 8, 2010
Applied in r79810
Thanks for the suggestion.