Opened 12 years ago
Closed 11 years ago
#9469 closed enhancement (fixed)
Category membership, without arguments
Reported by: | Nicolas M. Thiéry | Owned by: | Nicolas M. Thiéry |
---|---|---|---|
Priority: | major | Milestone: | sage-5.0 |
Component: | categories | Keywords: | Cernay2012 |
Cc: | Sage Combinat CC user | Merged in: | sage-5.0.beta6 |
Authors: | Nicolas M. Thiéry | Reviewers: | Florent Hivert |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
Currently one can do:
sage: F = FreeModule(QQ,3) sage: F in VectorSpaces(QQ) True
This patch implements:
sage: F in VectorSpaces True
(and does a couple closeby minor improvements to the doc)
Attachments (1)
Change History (14)
comment:1 Changed 12 years ago by
Status: | new → needs_review |
---|
comment:2 Changed 12 years ago by
Status: | needs_review → needs_work |
---|
comment:3 Changed 11 years ago by
Description: | modified (diff) |
---|---|
Keywords: | Cernay2012 added |
Status: | needs_work → needs_review |
comment:4 Changed 11 years ago by
Status: | needs_review → positive_review |
---|
comment:5 Changed 11 years ago by
Status: | positive_review → needs_work |
---|
Florent wants to add a pointer to the feature elsewhere
comment:6 Changed 11 years ago by
Status: | needs_work → needs_review |
---|
comment:7 Changed 11 years ago by
Status: | needs_review → positive_review |
---|
The new patch is Ok with me.
comment:8 Changed 11 years ago by
Status: | positive_review → needs_work |
---|
I just stumbled upon the following hunk later in the queue, and thought we might as well fold it into this patch:
diff --git a/sage/categories/category.py b/sage/categories/category.py --- a/sage/categories/category.py +++ b/sage/categories/category.py @@ -627,8 +627,19 @@ class Category(UniqueRepresentation, Sag sage: F in Algebras False + + TESTS: + + Non category object shall be handled properly:: + + sage: [1,2] in Algebras + False """ - return any(isinstance(cat, cls) for cat in x.categories()) + try: + c = x.categories() + except AttributeError: + return False + return any(isinstance(cat, cls) for cat in c) def is_abelian(self): """
I am running the tests now. Florent: shall I reinstate the positive review if the test pass?
comment:9 Changed 11 years ago by
Status: | needs_work → needs_review |
---|
Changed 11 years ago by
Attachment: | trac_9469-category-membership_without_arguments-nt.patch added |
---|
comment:12 Changed 11 years ago by
Status: | needs_review → positive_review |
---|
The new version is Ok with me !
comment:13 Changed 11 years ago by
Merged in: | → sage-5.0.beta6 |
---|---|
Resolution: | → fixed |
Status: | positive_review → closed |
Note: See
TracTickets for help on using
tickets.
Patch reviewed by Florent on the Sage-Combinat queue. Positive review on his behalf.