#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 nthiery):
Replying to [comment:26 SimonKing]:
> Concerning lazy attributes: I wonder whether one could add a method
`rename(name)` to a lazy attribute. That method would return a copy of the
original lazy attribute, but with a new name.
>
> Then, the example above would become
> {{{
> sage: class Foo(object):
> ....: @lazy_attribute
> ....: def _bar(self):
> ....: return 5
> ....: bar = _bar.rename("bar")
> ....:
> sage: f = Foo
> sage: f.bar.__name__
> 'bar'
> }}}
For what's its worth, a potential variant:
{{{
sage: class Foo(object):
....: @lazy_attribute(name="bar")
....: def _bar(self):
....: return 5
....: bar = _bar.rename("bar")
....:
sage: f = Foo
sage: f.bar.__name__
'bar'
}}}
In our use case, we want the lazy attribute parent_class_from_bases to be
called parent_class whenever it's used by subclasses of Category.
Cheers,
Nicolas
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11935#comment:29>
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.