#17002: Poset is_chain: Trivial simplification
-----------------------------+----------------------------
   Reporter:  jmantysalo     |            Owner:
       Type:  enhancement    |           Status:  new
   Priority:  trivial        |        Milestone:  sage-6.4
  Component:  combinatorics  |         Keywords:
  Merged in:                 |          Authors:
  Reviewers:                 |  Report Upstream:  N/A
Work issues:                 |           Branch:
     Commit:                 |     Dependencies:
   Stopgaps:                 |
-----------------------------+----------------------------
 A poset is chain if |V|-1=|E|, no vertex has out-degree >1 and no vertex
 has in-degree >1. Hence after #16984 code block

 {{{
 seen_0 = False
 for d in self.out_degree():
     if d == 1:
         pass
     elif d == 0:
         if seen_0:
             return False
          seen_0 = True
      else:
          return False
 }}}

 can be shortened to be just

 {{{
 if any(d>1 for d in self.out_degree()):
     return False
 }}}

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