Hi Nicolas, On 30 Mrz., 08:32, "Nicolas M. Thiery" <nicolas.thi...@u-psud.fr> wrote: > On Wed, Mar 30, 2011 at 02:00:22AM -0400, David Roe wrote: > > I think that base_ring and parent are cpdef'd methods (I don't want to > > look it up at the moment). > > Not at this point apparently: category_object.pyx, line 479: > > def base_ring(self): # This should be in a category or elsewhere, but not > here > return self._base > > def base(self): > return self._base > > Maybe making them such would solve Simon's problem? And actually > accelerate things, since Cython could optimize (inline?) their call in > the coercion/arithmetic code.
I was just starting to try that, and found in category_object.pxd: cdef class CategoryObject(sage_object.SageObject): cdef _generators cdef _category cdef public _base cdef public _cdata cdef public _names # will be _printer cdef public _factory_data cdef object __weakref__ # cpdef Generators gens(self, category = *) # cpdef gen(self, index = *, category = *) # cpdef ngens(self, category = *) # cpdef base(self, category = *) # cpdef base_extend(self, other, category = *) So, apparently it *was* thought of making these things cpdef!! Was there a reasong to not make base and base_ring cpdef? > Another trick to try would be add in Modules.ParentMethods: > > def __init_extra__(self): > self.basis_ring = self.base_ring > > therefore adding a short path for base_ring in all parents in Modules. > This should be rather safe (I don't expect the base_ring method to > change over time). You mean, the category framework would be used to speed things up? That would be nice! Cheers, Simon -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org