Your code for parent/element structures is supposed to look like: class FooE(Element): ... stuff ...
class FooP(Parent): Element = FooE def _element_constructor_(self, arg) return self.element_class(arg) ... more stuff... The FooP.element_class is dynamically generated from FooP.Element, and this is the class that is named FooE_with_category. You never use FooE directly, always FooP.element_class. In particular, if you later add a derived class class DerivedFooP(FooP): Element = DerivedFooE then the inherited methods will automatically use the derived self.element_class. Some of the category stuff uses that dynamically generated class as a mechanism to implement its functionality, which is where the name comes from. Its a bit of a misnomer. IMHO the category functionality would have been better implemented by a proper metaclass than by dynamically assigning to __class__ to dynamically construct the class at import time, not at construction time. And only have one class instead of the confusion with FooE vs. FooE_with_category. And as a further warning, this was for Python element classes---Cython classes are different again. On Friday, August 8, 2014 3:04:39 PM UTC+1, Nathann Cohen wrote: > > But why isn't it reported as an attribute error of the class that was > created by the user, i.e. EllipticCurve_field ? I understand that the > category mechanism will try to find the method elsewhere if it is not > defined, but still: it seems to say that "whatever the method that was > not found" it should have been implemented in some category code > instead of .... in EllipticCurve_field directly. > > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.