#16537: Python 3 preparation: Use "rich comparison" - std function cmp() is
gone,
method __cmp__ is ignored
---------------------------------+------------------------
Reporter: wluebbe | Owner:
Type: PLEASE CHANGE | Status: new
Priority: major | Milestone: sage-6.3
Component: distribution | Resolution:
Keywords: python3 | Merged in:
Authors: | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: | Stopgaps:
---------------------------------+------------------------
Comment (by wluebbe):
I did some grepping to get a first impression of the amount of work
required:
||{{{git grep -P "def\s+__cmp__" |wc -l}}} ||377||
|| || ||
||{{{git grep -P "def\s+__eq__" |wc -l}}} ||170||
||{{{git grep -P "def\s+__ne__" |wc -l}}} ||70||
||{{{git grep -P "def\s+__lt__" |wc -l}}} ||29||
||{{{git grep -P "def\s+__le__" |wc -l}}} ||18||
||{{{git grep -P "def\s+__gt__" |wc -l}}} ||21||
||{{{git grep -P "def\s+__ge__" |wc -l}}} ||18||
|| || ||
||{{{git grep -P "\bcmp\s*\(" |wc -l}}} ||1042||
The conclusion seems that we have to implement //rich comparison// (i.e.
define {{{__eq__}}} with {{{__ne__}}} and {{{__gt__}}} with the class
decorator {{{functools.total_ordering}}}) for about 350 classes!
And then there are those 1000+ calls to {{{cmp}}}.
And unfortunately the changes are mostly not syntactical but they require
insight into the code!
--
Ticket URL: <http://trac.sagemath.org/ticket/16537#comment:1>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.