Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Create new structure class and define its element

Hello. I have a problem with the Element class of a new structure. In detail, I am defining a new subclass of Polynomial Ring via

class MyElement(sage.rings.polynomial.multi_polynomial_element.MPolynomial_polydict):

class MyAlgebra(sage.structure.unique_representation.UniqueRepresentation, sage.rings.polynomial.multi_polynomial_ring.MPolynomialRing_polydict):

Now, I have:

sage: A=MyAlgebra(QQ,1,'x',order="lex")
sage: (x,)=A.gens()
sage: type(x)
<class 'sage.rings.polynomial.multi_polynomial_element.MPolynomial_polydict'>


sage: a=MyElement(A,{(1,):1})
sage: type(a)
<class '__main__.MyElement'>

Why isn't the element x of type MyElement?