#15283: Rowmotion and Panyushev orbits: iterators for orbits and better doc
-------------------------------------------------+-------------------------
       Reporter:  darij                          |        Owner:
           Type:  enhancement                    |       Status:
       Priority:  major                          |  positive_review
      Component:  combinatorics                  |    Milestone:  sage-5.13
       Keywords:  posets, rowmotion, sage-       |   Resolution:
  combinat, panyushev, order-ideals, categories  |    Merged in:
        Authors:  Darij Grinberg                 |    Reviewers:  Nathann
Report Upstream:  N/A                            |  Cohen
         Branch:                                 |  Work issues:
   Dependencies:                                 |       Commit:
                                                 |     Stopgaps:
-------------------------------------------------+-------------------------

Comment (by nbruin):

 Replying to [comment:10 darij]:
 > I don't think {{{self.lt}}} returns the right format for {{{sorted}}}.
 It seems that the {{{cmp}}} keyword of {{{sorted}}} wants a total
 -1,0,1-valued function, not a boolean one. See how this prints the same
 list twice:
 > {{{
 > P = Poset({i: divisors(i) for i in divisors(24)})
 > print sorted(list(P), cmp=P.lt)
 > print sorted(list(P), cmp=P.gt)
 > }}}
 The recommended way is to use `sorted(...,key=...)` where `key` should map
 the sequence elements into a totally ordered set (for instance, the
 integers). This provides a concise way of the decorate-sort-undecorate
 pattern, or ''Schwartzian transform'', which is generally more efficient
 than sorting with a likely expensive custom sort function.

 The `cmp` keyword is actually removed in Python 3. See
 `functools.cmp_to_key` to convert a legitimate `cmp` function into a value
 suitable for `key`.

--
Ticket URL: <http://trac.sagemath.org/ticket/15283#comment:16>
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/groups/opt_out.

Reply via email to