#20028: sorting of number field elements
-------------------------------------+-------------------------------------
       Reporter:  cremona            |        Owner:
           Type:  defect             |       Status:  new
       Priority:  major              |    Milestone:  sage-7.1
      Component:  number fields      |   Resolution:
       Keywords:  sort number field  |    Merged in:
  elements                           |    Reviewers:
        Authors:                     |  Work issues:
Report Upstream:  N/A                |       Commit:
         Branch:  u/cremona/20028    |  2016dd34852bbdae2bac70e66451bed830753f10
   Dependencies:  #20064             |     Stopgaps:
-------------------------------------+-------------------------------------

Comment (by nbruin):

 Replying to [comment:11 cremona]:
 > Question:  when doing something like sorted(v,key=list) where v is a
 list of nf elements in a *relative* number field, I suppose that the
 coefficient list elements are themselves nf elements which must be sorted
 somehow?  What is happening then?

 I don't think `key=list` is a valid way of sorting for relative number
 fields (unless the base field is embedded and inherits an ordering from
 that).

 Are you wondering whether we should have a "generic" key function other
 than "str"? I think that would require another protocol, where objects are
 required to have a `__default_sorting_key__` method or something similar,
 and probably a access function `default_sorting_key` that would
 recursively walk tuples etc (but not sets unless we'd have a way to
 symmetrize the keys) and call this method on relevant objects.

 My feeling is that the need for such a function is not so pressing just
 yet, and that we're better off with people having to think about what key
 they use every time they need one (and in the process perhaps recognize
 when they don't need sorting).

--
Ticket URL: <http://trac.sagemath.org/ticket/20028#comment:35>
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 https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to