On 19/06/16 20:29, Arpit Merchant wrote:
Hello,

AttributeError: 'CenterSkewPolynomialRing_with_category' object
has no attribute 'element_class'

is due to some bad initialization. There should be an attribute
"Element" defined on the parent before calling the "Parent"
constructor. In other words, you should follow the following
pattern


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.

Is it better?
Vincent

--
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.

Reply via email to