[sage-devel] Re: element construction by parent with multiple element classes

2014-08-24 Thread Travis Scrimshaw
> > In that case I would go with the construction that Simon proposed, have > completely different parents. And define a coercion from grading-preserving > morphisms to shift-by-0. No need to have a single parent for > perhaps-shifted morphisms, and you can leverage the existing framework > in

Re: [sage-devel] Re: element construction by parent with multiple element classes

2014-08-24 Thread Daniel Krenn
Am 2014-08-24 um 16:28 schrieb Volker Braun: > On Sunday, August 24, 2014 1:38:51 PM UTC+1, Daniel Krenn wrote: > > MyElementAdd(MyElementAtom, MyElementMul(MyElementAtom, > MyElementAtom) > should be a valid element for my parent. > > Are these classes? You mean there is an open-en

Re: [sage-devel] Re: element construction by parent with multiple element classes

2014-08-24 Thread Volker Braun
On Sunday, August 24, 2014 1:38:51 PM UTC+1, Daniel Krenn wrote: > > MyElementAdd(MyElementAtom, MyElementMul(MyElementAtom, MyElementAtom) > should be a valid element for my parent. > Are these classes? You mean there is an open-ended number of classes? (I thought a while about making the r

Re: [sage-devel] Re: element construction by parent with multiple element classes

2014-08-24 Thread Daniel Krenn
Am 2014-08-23 um 17:16 schrieb Simon King: > Hi Daniel, > > On 2014-08-23, Daniel Krenn 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 > insta

Re: [sage-devel] Re: element construction by parent with multiple element classes

2014-08-24 Thread Daniel Krenn
Am 2014-08-23 um 13:20 schrieb Volker Braun: > IMHO this will turn out to be a mistake later on. [...] Ok. Maybe I'll say a bit mor about my classes. I have a recursive structure of formal things. There is a MyElementBase as abstract base class, then there is a MyElementAtom. Moreover, there are

[sage-devel] Re: element construction by parent with multiple element classes

2014-08-24 Thread Volker Braun
On Sunday, August 24, 2014 3:04:33 AM UTC+1, Travis Scrimshaw wrote: > > Another (and broader) example would be graded modules, where we have > morphism which preserve grading and those with a grading shift. > In that case I would go with the construction that Simon proposed, have completely dif

[sage-devel] Re: element construction by parent with multiple element classes

2014-08-23 Thread Travis Scrimshaw
Hey, > 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

[sage-devel] Re: element construction by parent with multiple element classes

2014-08-23 Thread Simon King
Hi Daniel, On 2014-08-23, Daniel Krenn 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 e

[sage-devel] Re: element construction by parent with multiple element classes

2014-08-23 Thread Simon King
Hi! On 2014-08-23, Vincent Delecroix <20100.delecr...@gmail.com> wrote: > You must bypass the element_class. > > 1) Convert your base classes to categorized classes using something along > > Parent P: > def ___init__(self): > self.element_class_A = self.__make_element_class__(MyElement

[sage-devel] Re: element construction by parent with multiple element classes

2014-08-23 Thread Volker Braun
IMHO this will turn out to be a mistake later on. I know, its tempting to special-case some elements in a derived class but in my experience it always ended up with a more complicated code than if you just stick with a single element class. It is a single algebraic structure, so all elements sh