#11935: Make parent/element classes independent of base rings
---------------------------+------------------------------------------------
Reporter: SimonKing | Owner: nthiery
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-4.8
Component: categories | Keywords: parent class, element class,
category
Work_issues: | Upstream: N/A
Reviewer: | Author: Simon King
Merged: | Dependencies: #9138 #11900 #11943 #11999
---------------------------+------------------------------------------------
Comment(by SimonKing):
Replying to [comment:29 nthiery]:
> For what's its worth, a potential variant:
> {{{
> sage: class Foo(object):
> ....: @lazy_attribute(name="bar")
You mean: Add an optional argument "name" to the lazy attribute? I was
thinking about that, too.
Using it means that (in the example above) `f._bar` would result in
assigning `f.__dict__["bar"] = 5` (note: "bar", not "_bar", even though
the lazy attribute is called requested as "_bar").
So, when we do
{{{
@lazy_attribute(name="parent_class")
def _parent_class_from_bases(self):
return bla
}}}
then the following would happen, where C is a category:
* `C._parent_class_from_bases` would write its result into
`C.parent_class`, thus, potentially overriding an already existing parent
class. Do we want that such a dangerous thing can happen?
* On the bright side, we could easily do
{{{
class Foo(Category):
parent_class = _parent_class_from_bases
}}}
without renaming, because the name is already right.
If you think this should be added, I can easily do so on #11999.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11935#comment:31>
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.