-
-
Notifications
You must be signed in to change notification settings - Fork 572
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Element overrides python behavior of cmp #14065
Comments
Dependencies: #14052 |
comment:2
Dependency on #14052 is due to an added doctest there that changes. |
This comment has been minimized.
This comment has been minimized.
Attachment: trac_14065-combinatorial_object_cmp-ts.patch.gz Expanded doctests |
This comment has been minimized.
This comment has been minimized.
comment:4
Added additional doctests about the MRO. |
comment:5
Looks good to me. I've added a review patch which simplifies the implementation a bit. If you're fine with it, you can set this to positive review. |
Reviewer: Mike Hansen |
comment:6
Looks good to me. Thank you Mike. |
Changed keywords from Element, cmp to Element, cmp, days45 |
Merged: sage-5.8.beta0 |
As part of #12913, we are adding inheritance from
Element
to many classes that inherit fromCombinatorialObject
. However, there are many functions are relying on a valid call tocmp
, butElement
overrides this. This patch is a fix which implements a basic__cmp__
forCombinatorialObject
for the switch.Another issue this ticket does is add a
__nonzero__()
toCombinatorialObject
so things likeif p:
andnot p
will work when also inheriting fromElement
(which checks against theParent().zero_element()
and is not implemented for all parents).Here's an example of how this breaks:
NOTE - After the patch, the
CombinatorialObject
needs to come beforeElement
because of the MRO.Depends on #14052
CC: @nthiery @sagetrac-sage-combinat
Component: combinatorics
Keywords: Element, cmp, days45
Author: Travis Scrimshaw
Reviewer: Mike Hansen
Merged: sage-5.8.beta0
Issue created by migration from https://trac.sagemath.org/ticket/14065
The text was updated successfully, but these errors were encountered: