Hi Mark! On Mon, Mar 23, 2015 at 12:17:34PM -0700, Mark Shimozono wrote: > I am trying to think of a decent way to have an arbitrary > subcategory of Modules() to "inherit" the base_ring method. > Would it be possible to have special kinds of methods/attributes > that are "inherited" by Category_over_base > from the base category? (Of course I have :method:`base_ring` > in mind). Ditto for any category constructor through which one might > want to inherit methods. > Does a JoinCategory inherit from its supercategories > automatically (or could the above idea be implemented for > JoinCategories > as well)?
Sorry for the slow answer: it's pretty intense here at AIMS while simultaneously finishing up projects from the Sage Days! I'll reserve an hour or so soon to think seriously about the issue. In the mean time ... If a method is put in SubcategoryMethods, then every subcategory of Blahs inherits from it:: class Blahs(Category): def super_categories(self): return [Objects()] class SubcategoryMethods: def x(self): print "x", self class Foos(Category): def super_categories(self): return [Blahs()] sage: Foos().x() x Category of foos So this sounds like a good candidate for the desired base_ring method. There is one caveat though, which is that base_ring needs to find the appropriate information! SubcategoryMethods gives inheritance of methods but not of attributes. Worst case, one could implement base_ring by walking up the category hierarchy until an actual base_ring method is found, and call it. Cheers, Nicolas -- Nicolas M. ThiƩry "Isil" <nthi...@users.sf.net> http://Nicolas.Thiery.name/ -- You received this message because you are subscribed to the Google Groups "sage-combinat-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-combinat-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-combinat-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-combinat-devel. For more options, visit https://groups.google.com/d/optout.