I'm going through [1] to construct a new algebraic structure. I have one
parent, but want more than one elements, which should be associated to
this parent. More precisely, I have the following classes:

+- MyElementBase
   +-- MyElementA (derived from MyElementBase)
   +-- MyElementB (derived from MyElementBase)

In [1] it says, we should use
  return self.element_class(data)
in Parent._element_constructor_ to create objects. This creates a class
derived from Parent.Element (which IMHO should be MyElementBase) and
Parent.category().element_class.

How can I create "the correct" instance of MyElementA and MyElementB
inside _element_constructor_ depending on the input? (I want to do this,
since MyElementA is a specialized version of MyElementBase for some
inputs; similar MyElementB)

Daniel

[1]
http://www.sagemath.org/doc/thematic_tutorials/coercion_and_categories.html

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

Reply via email to