#10667: Morphisms and Objects of Categories
---------------------------+------------------------------------------------
Reporter: SimonKing | Owner: nthiery
Type: enhancement | Status: needs_work
Priority: major | Milestone: sage-5.0
Component: categories | Keywords: objects morphisms containment
Work_issues: doctests | Upstream: N/A
Reviewer: | Author: Simon King
Merged: | Dependencies: #9138, #11115
---------------------------+------------------------------------------------
Comment(by SimonKing):
It seems to me that the implementation can not so easily be cleaned.
In some cases, we do want that the hom category of a category inherits
stuff from the hom category of a super category - simply in order to avoid
code duplication. For example, `VectorSpaces(...).hom_category()` does
(and should) inherit from `Modules(...).hom_category()`.
In other cases, we do not want that inheritance. For example, we do not
want that `Algebras(...).hom_category()` inherits from
`VectorSpaces(...).hom_category()`.
Indeed, we currently have
{{{
sage: Algebras(QQ).hom_category().extra_super_categories()
[Category of sets]
}}}
I tried to understand why we have the above answer. We have
{{{
sage: Algebras(QQ).hom_category().extra_super_categories.__module__
'sage.categories.rings'
}}}
So, the method is inherited from the hom category of the category of
rings.
Why is it (correctly) not inherited from the hom category of the category
of Q-modules?
{{{
sage: Modules(QQ).hom_category().extra_super_categories()
[Category of vector spaces over Rational Field]
}}}
It seems to me that the correct inheritence is just due to the fact that
`Algebras(...).super_categories()` returns first `Rings()` and then
`Modules(...)`
{{{
sage: Algebras(QQ).super_categories()
[Category of rings, Category of vector spaces over Rational Field]
}}}
If that list would be returned in the opposite order, then
`Algebras(QQ).hom_category()` would pick up the `extra_super_categories`
method from `Modules(QQ).hom_category()`, which would not be correct.
I think that inheritance being dependent on the order of a list of super
categories is very much error prone and difficult to debug.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10667#comment:20>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.