#11935: Make parent/element classes independent of base rings
-------------------------------------------+--------------------------------
Reporter: SimonKing | Owner: nthiery
Type: enhancement | Status: needs_work
Priority: major | Milestone: sage-4.8
Component: categories | Keywords: parent class,
element class, category
Work_issues: introduce _make_named_class | Upstream: N/A
Reviewer: | Author: Simon King
Merged: | Dependencies: #9138 #11900
#11943
-------------------------------------------+--------------------------------
Changes (by SimonKing):
* status: needs_review => needs_work
* work_issues: => introduce _make_named_class
Comment:
Some suggestion of Nicolas: The creation of the parent_class and of the
element_class follow the same logic: We have the corresponding classes of
the super categories, take them as bases, and add some methods that are
available in the attribute `ParentMethods` or `ElementMethods`.
So, it seems reasonable to write a new method that implements that logic.
Then, parent_class and element_class would both simply call that method.
Originally, we suggested the name `_make_member_class` for that method,
because it creates a class for some member (object, element of object, or
in future morphism) of the category.
But meanwhile I prefer the name `_make_named_class`, because the parameter
is indeed a name. So, roughly like this:
{{{
#!python
class Category:
...
def _make_named_class(self, name, methods_holder):
the default logic
@lazy_attribute
def parent_class(self):
return self._make_named_class("parent_class", "ParentMethods")
@lazy_attribute
def element_class(self):
return self._make_named_class("element_class", "ElementMethods")
}}}
Then, `CategoryWithParameters` only needs to override one thing, namely
`_make_named_class`.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11935#comment:37>
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.