Hi Daniel,

On 2014-08-23, Daniel Krenn <kr...@aon.at> wrote:
> +- MyElementBase
>    +-- MyElementA (derived from MyElementBase)
>    +-- MyElementB (derived from MyElementBase)

I wonder: Is it really the case that one single parent P, which is an
instance of a parent class P_class, shall simultaneously have elements
of type MyElementA and MyElementB? Or is it rather the case that you
have one single parent class P_class, and then have two instances P_A
and P_B of P_class, where P_A's elements should be instances of
MyElementA and P_B's elements of MyElementB?

In the latter case, you could do (depending on the parameters used to
create P_A and P_B) for example:
  class P_class(Parent):
      def __init__(self, *args, implementation='A'):
          if implementation=='A':
              self.Element = MyElementA
          else:
              self.Element = MyElementB
          <more initialisation>
          Parent.__init__(self, category=<whatever>)

Then, P_A = P_class(implementation='A') would automagically have
P_A.element_class inherited from MyElementA.

Best regards,
Simon


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