On Tuesday, June 27, 2017 at 4:31:44 AM UTC-5, Jeroen Demeyer wrote: > > Suppose that R is some parent which is contained in the category > Algebras(B) for some ring B, how does one determine B from the parent R? > > I am asking because I want to implement a new method in the > ParentMethods of Algebras, which needs to refer to the base_ring of the > category. I feel like ParentMethods should have a way to refer back to > the category where the ParentMethods was defined. >
If I understand what you're asking correctly, you can just ask for the base ring of the category: sage: Algebras(QQ).WithBasis().Graded() Category of graded algebras with basis over Rational Field sage: _.base_ring() Rational Field Although not tall categories are defined over the exact base ring of the algebra, but recall that sometimes instead they are given over a category like Rings or Fields(). This was done so we didn't have to create a number of categories over, say, GF(p) as the prime p ranges. So this is not always a safe method to get the base ring of the parent. However, I'm +1 for doing something to remove base_ring() from Parent. Unfortunately, this is probably not the way to do so. Best, Travis -- 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 https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.