#16536: Python 3 preparation: cmp parameter of sorted() function and L.sort()
method are gone
-----------------------------+----------------------------
   Reporter:  wluebbe        |            Owner:
       Type:  PLEASE CHANGE  |           Status:  new
   Priority:  major          |        Milestone:  sage-6.3
  Component:  distribution   |         Keywords:  python3
  Merged in:                 |          Authors:
  Reviewers:                 |  Report Upstream:  N/A
Work issues:                 |           Branch:
     Commit:                 |     Dependencies:
   Stopgaps:                 |
-----------------------------+----------------------------
 In Py2 the standard function
 [[https://docs.python.org/2/library/functions.html#sorted|sorted()]] and
 the mutable list method [[https://docs.python.org/2/library/stdtypes.html
 #mutable-sequence-types|sort()]] both have an optional parameter
 {{{cmp=}}} that takes a custom comparison function of two arguments.

 The parameter is no more available in Py3.

 The recommended way is to use the {{{key=}}} which specifies a function of
 one argument that is used to extract a comparison key from each list
 element. This has also better performance.

 While there is a function
 
[[https://docs.python.org/2/library/functools.html#functools.cmp_to_key|functools.cmp_to_key()]]
 to convert an old-style cmp function to a key function, it is preferable
 to directly use an appropriate key function.

 This ticket is tracked as a dependency of meta-ticket ticket:15980.

--
Ticket URL: <http://trac.sagemath.org/ticket/16536>
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.

Reply via email to