Hi Thomas, sorry, I first got your mail off-list, and thought that you did not post here.
On 2013-07-05, Thomas Feulner <thomas.feul...@uni-bayreuth.de> wrote: > You are right, maybe my example was to tiny. Here is another one, which > also initializes the > QuotientRing_nc, too: > > sage: from sage.rings.quotient_ring import QuotientRing_nc > sage: class Y(Parent): > ....: def __init__(self, gens, names): > ....: Parent.__init__(self, Integers(), gens=gens, names= > names) > sage: class X(Y, QuotientRing_nc): > ....: def __init__(self, R, I): > ....: Y.__init__(self, gens=[R.gen(0), R.gen(1)], names=['x' > , 'y']) > ....: QuotientRing_nc.__init__(R, I) > sage: R = PolynomialRing(Integers(), 'a,b,c') > sage: R.ideal(R.gen(0)) > Ideal (a) of Multivariate Polynomial Ring in a, b, c over Integer Ring > sage: x = X(R, I) > > But the problem is still there. Do you have any other suggestions? QuotientRing_nc inherits a placeholder method ngens from ParentWithGens. This needs to be implemented. In the code below, I hardcode that the number of generators is two, but of course in real applications one needs to do something more fancy. In any case, when QuotientRing_nc.__init__(self,...) is called, then self.ngens() must be able to return the correct answer. Moreover, it seems to be needed to first call QuotientRing_nc.__init__ and call Y.__init__ only after that. It is not totally clear to me why this is needed. Anyway, the following does not crash: sage: class Y(Parent): ....: def __init__(self, gens, names): ....: V = Integers()**2 ....: Parent.__init__(self, Integers(), gens=(V.gen(0), V.gen(1)), names=names) ....: sage: R.<a,b,c> = ZZ[] sage: I = R*[a] sage: class X(Y, QuotientRing_nc): ....: def __init__(self, R, I): ....: QuotientRing_nc.__init__(self, R, I, names=['x', 'y']) ....: Y.__init__(self, gens=[R.gen(0), R.gen(1)], names=self.variable_names()) ....: def ngens(self): ....: return 2 ....: sage: x = X(R, I) sage: x Quotient of Multivariate Polynomial Ring in a, b, c over Integer Ring by the ideal (a) sage: x.variable_names() ('x', 'y') Note that I use names=self.variable_names() in Y.__init__ just for fun. When it is called, the variable_names() are already available. 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/groups/opt_out.