> > > 1 class MyElement(Element): > 2 ... > 3 > 4 class MyParent(Parent): > 5 Element = MyElement > 6 > 7 def __init__(self, ...): > 8 ... > 9 Parent.__init__(self, ...) > > I'm not sure I understand what you mean. Could you please elaborate >> a little? >> > > The attribute `element_class` of parents is created during the parent > constructor, i.e. the __init__. It creates with dynamical inheritance a > new class "element_class" which will inherits new methods depending of > the category of your parent. > > In order to work, there should be an attribute "Element" available (line 5 > in the above snippet). Your > class `CenterSkewPolynomialRing` is a parent that modelizes a set. It > either inherits from Parent, or Ring or something similar. And the objects > that belong to it should inherit from Element or RingElement or something > similar. > > Just to restate, MyParent here is CenterSkewPolynomialRing which inherits from class PolynomialRing_general which inherits from sage.algebras.algebra.Algebra. Indeed, the constructor of CenterSkewPolynomialRing takes `element_class` as input (which by default, is None).
What does MyElement represent in your example? What is its connection to MyParent? And since Element is itself a class, won't writing Element = MyElement give a syntax error? -Arpit. -- 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 https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.