#10963: More functorial constructions
-------------------------------------+-------------------------------------
Reporter: nthiery | Owner: stumpc5
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-6.1
Component: categories | Resolution:
Keywords: days54 | Merged in:
Authors: Nicolas M. Thiéry | Reviewers: Simon King, Frédéric
Report Upstream: N/A | Chapoton
Branch: | Work issues:
public/ticket/10963 | Commit:
Dependencies: #11224, #8327, | ec340363a811bbafbb8cd5ff8f39e75db9872f9f
#10193, #12895, #14516, #14722, | Stopgaps:
#13589, #14471, #15069, #15094, |
#11688, #13394, #15150, #15506 |
-------------------------------------+-------------------------------------
Comment (by SimonKing):
Replying to [comment:305 nbruin]:
> Replying to [comment:302 SimonKing]:
> > Do you think that it is a valid solution to let
`._base_category_class_and_axiom` be explicitly set, with the exception of
5 cases in which it is computed/guessed by a lazy attribute?
> Would it be too onerous to just change/handcode those 5 cases?
These 5 are those that appear when starting Sage. Nicolas, can you
guarantee that all categories-with-axiom that are created after starting
Sage will be constructed by means of the `__classget__`?
I think it would be good to get rid of the guesswork! For example, it
makes it impossible to create a new category with axiom just
''somewhere'': The module name must be chosen according to the name of the
category class, or creation of an instance of this class will fail.
{{{
sage: from sage.categories.category_with_axiom import CategoryWithAxiom
sage: class MyAxiom(CategoryWithAxiom): pass
sage: C = MyAxiom()
Traceback (most recent call last):
...
/home/king/Sage/git/sage/local/lib/python2.7/site-
packages/sage/categories/category_with_axiom.pyc in
base_category_class_and_axiom(cls)
224 module = uncamelcase(name, "_")
225 assert cls.__module__ == "sage.categories."+module,\
--> 226 "%s should be implemented in `sage.categories.%s`"%(cls,
module)
227 for axiom in all_axioms:
228 if axiom == "WithBasis" and name.endswith(axiom):
AssertionError: <class '__main__.MyAxiom'> should be implemented in
`sage.categories.my_axiom`
}}}
And this is certainly not very pleasant. Occasionally I like to create a
category class on the fly, interactively, and I don't want to be forced to
implement it in a specific sub-module of sage.categories.
--
Ticket URL: <http://trac.sagemath.org/ticket/10963#comment:306>
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.