#13250: Additional poset examples
---------------------------------+------------------------------
Reporter: csar | Owner: sage-combinat
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-5.11
Component: combinatorics | Resolution:
Keywords: sd40 | Merged in:
Authors: | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Dependencies:
Stopgaps: |
---------------------------------+------------------------------
Comment (by tscrim):
Hey,
So `cls.mro()` returns the method resolution order (MRO for short), which
is the sequences of superclasses of the type (class) `cls` in some linear
order that used to in order to determine which method to call. The MRO is
used to solve what is known as the diamond problem with multiple
inheritance. All things in python will have one since all objects have one
and everything is an object. Also `cls.mro()` is equivalent (up to tuple
-> list) to calling `cls.__mro__`. In short, it does exactly as it says it
does because `posets` is a class.
More importantly, for the patch could you do the following:
- Implement Young's lattice using
{{{
Poset((partitions, Partition.contains))
}}}
as with the other similar prebuilt functions.
- It's not good practice to call the variable you iterate over the same as
the defining variable for the iteration:
{{{
partitions = flatten([list(Partitions(n)) for n in range(n+1)])
}}}
because `n` gets overwritten (of course that's not a problem here, but
in general this can be a subtle bug).
- The `cell_leq` method is not needed since the default comparison between
lists/tuples in python is lex which matches your definition (and your
current implementation does not match your def'n in that the def'n has
"or" whereas the test has "and").
- Could you split line 570 a few times? It's quite long.
- You'll need to put your real name as the author.
Once these are done, I'd be happy setting this to positive review.
Thanks,[[BR]]
Travis
--
Ticket URL: <http://trac.sagemath.org/ticket/13250#comment:6>
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.