#10963: More functorial constructions
-------------------------------------+-------------------------------------
Reporter: nthiery | Owner: stumpc5
Type: enhancement | Status: needs_info
Priority: major | Milestone: sage-6.2
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-doc- | Commit:
distributive | c718f218fbc726bf3cf7f4c3f20638c9b0c7eea7
Dependencies: #11224, #8327, | Stopgaps:
#10193, #12895, #14516, #14722, |
#13589, #14471, #15069, #15094, |
#11688, #13394, #15150, #15506 |
-------------------------------------+-------------------------------------
Comment (by SimonKing):
Do I see that correctly: In the current implementation, it is impossible
to pass an argument to an axiom.
Hence, we can do `Blas().Finite()`, but it would be syntactically
impossible to define an axiom such as "`FixedBaseRing`", so that
`Blas().FixedBaseRing(QQ)`. Or how would one define such thing?
I tried this:
{{{
class FixedBaseRing(CategoryWithAxiom):
def __init__(self, base_category, base_ring):
if base_ring not in base_category.base():
raise ValueError, "The base ring %s ought to be an object in
%s"%(base_ring, base_category.base())
CategoryWithAxiom.__init__(self, base_category)
self.__base_ring = base_ring
class SubcategoryMethods:
def base_ring(self):
return self.__base_ring
}}}
and
{{{
sage: class MyCategoryOverBase(Category_over_base):
....: def super_categories(self):
....: return [Objects()]
....: FixedBaseRing = FixedBaseRing
....: class SubcategoryMethods:
....: def FixedBaseRing(self, base_ring):
....: return self._with_axiom("FixedBaseRing")(base_ring)
....:
sage: C = MyCategoryOverBase(Rings())
}}}
but got
{{{
sage: C.FixedBaseRing(QQ)
Traceback (most recent call last):
...
TypeError: __init__() takes exactly 3 arguments (2 given)
}}}
which occurs internally when doing `C._with_axiom("FixedBaseRing")`.
Is there currently a way to implement this? Should `_with_axiom()` perhaps
accept optional arguments, to be passed to the init method of the
category-class-with-axiom, so that `C._with_axiom("FixedBaseRing", QQ)`
would happen internally?
--
Ticket URL: <http://trac.sagemath.org/ticket/10963#comment:517>
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.