Changes between Initial Version and Version 1 of Ticket #15283, comment 10


Ignore:
Timestamp:
Oct 23, 2013, 2:51:10 PM (9 years ago)
Author:
Darij Grinberg
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #15283, comment 10

    initial v1  
    1 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. Then again I can't get it to break, so maybe it works. Why is there no good doc for {{{sorted}}}??
     1I 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:
     2{{{
     3P = Poset({i: divisors(i) for i in divisors(24)})
     4print sorted(list(P), cmp=P.lt)
     5print sorted(list(P), cmp=P.gt)
     6}}}
    27
    3 And either way, I don't know how {{{sorted}}} would react if {{{cmp}}} fails to be antisymmetric, i. e., if there are two distinct elements which compare as equal or each smaller than the other. I'd hope the result would still be sorted, but who knows?
     8And either way, I don't know how {{{sorted}}} would react if {{{cmp}}} fails to be antisymmetric, i. e., if there are two distinct elements which compare as equal or each smaller than the other. I'd hope the result would still be sorted, but who knows? Why is there no good doc for {{{sorted}}}??
    49
    510I originally wanted to implement these functions as semantics for {{{is_chain}}} and {{{is_antichain}}}, but found that this would make the docstring rather confusing.