On Wed, Sep 7, 2011 at 7:34 AM, Simon King <simon.k...@uni-jena.de> wrote: > PS: > > The following is a clear bug IMHO. > sage: Q = QuotientRing(ZZ,8) > sage: F,R = Q.construction() > sage: F(R)==Q > False > > I think it would be better if the QuotientRing(R,I) constructor would > always return an instance of the class that suites best for quotients > of R. > > Note that it already does return an instance of a specialised class > in other cases: For quotients of univariate polynomial rings, it is > sage.rings.polynomial.polynomial_quotient_ring.PolynomialQuotientRing_generic. > > So, why should a generic implementation be used for quotients of ZZ, > even more when the construction of the quotient does not reproduce the > quotient?
I remember writing the QuotientRing_generic class back in 2005 when there were no quotient rings in Sage yet (after a conversation with Joe Wetherell and David Kohel...). The file sage/rings/quotient_ring.py has a function "QuotientRing", and its initial behavior was to create an object of type QuotientRing_generic. It still does that in some cases: sage: Q = QuotientRing(ZZ,8) sage: type(Q) <class 'sage.rings.quotient_ring.QuotientRing_generic'> Simon, I agree with you. The function "QuotientRing" should be improved so that it works like the functor, e.g,. calls the ".quo(...)" method if it exists. In fact, the code in _apply_functor in sage/categories/pushout.py (which I had nothing to do with) and the code in the QuotientRing function should be refactored so the actual construction only involves calling one function that does the work. -- William -- William Stein Professor of Mathematics University of Washington http://wstein.org -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org