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. > You want to be a little careful overriding such methods with > Python functions living in the dictionary, because then the > functions called by Cython code that knows the type of your > object, and the code called by Python code will be different. 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). Cheers, Nicolas -- Nicolas M. ThiƩry "Isil" <nthi...@users.sf.net> http://Nicolas.Thiery.name/ -- 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