#12877: Categories for padics, schemes, and some more rings
-------------------------------------+--------------------------------------
Reporter: nthiery | Owner:
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-5.1
Component: categories | Resolution:
Keywords: | Work issues:
Report Upstream: N/A | Reviewers:
Authors: Nicolas M. ThiƩry | Merged in:
Dependencies: | Stopgaps:
-------------------------------------+--------------------------------------
Changes (by SimonKing):
* owner: nthiery =>
Comment:
Replying to [comment:4 SimonKing]:
> I am sure that you did try something like
`getattr(super(self,LazyField),name)`. Did that not work? Why?
I tested (it should be `super(LazyField,self)`), and indeed it does not
work. But still, one could add the stuff from the custom
`Parent.__getattr__` into the custom `LazyField.__getattr__`:
{{{
sage: cython("""
....: from sage.structure.parent cimport Parent
....: from sage.structure.parent import getattr_from_other_class
....: cdef class MyParent(Parent):
....: def __getattr__(self, name):
....: print "here is the custom getattr with", name
....: return getattr_from_other_class(self,
self.category().parent_class, name)
....: """)
sage: P = MyParent(category=CommutativeAdditiveSemigroups())
here is the custom getattr with _element_constructor_
here is the custom getattr with Element
here is the custom getattr with element_class
sage: P.addition_table
here is the custom getattr with addition_table
here is the custom getattr with __custom_name
here is the custom getattr with _repr_
<bound method CommutativeAdditiveSemigroups.parent_class.addition_table of
<type '_mnt_local_king__sage_temp_mpc622_12258_tmp_4_spyx_0.MyParent'>>
}}}
There is also some more stuff in `Parent.__getattr__`, that was written
for cached methods.
The question is whether the code duplication would be worth the effort.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12877#comment:5>
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.