Hi! Before I open a ticket, I'd like to get some feedback.
My experimental extension of the category framework can do the following: 1) It detects containment in categories even if the category has not been initialised: sage: P.<a,b,c> = QQ['x'][] sage: P.Element = type(a) sage: PC_orig = type(P) sage: P._is_category_initialized() False sage: P.category() Category of commutative rings sage: P in LeftModules(QQ['x']) True 2) It updates the category (i.e., moves on to a sub-category), according to what the containment tests revealed: sage: P.category() Join of Category of commutative rings and Category of left modules over Univariate Polynomial Ring in x over Rational Field 3) The parent and element classes change (the element class is supposed to exist). But they are sub-classes of the old classes: sage: issubclass(P.element_class,type(a)) True sage: P.element_class == type(a) False sage:issubclass(type(P),PC_orig) True sage: PC_orig == type(P) False Note that moving from the old category to a subcategory means that the elements of P may inherit additional methods from the new category - this even holds for elements created before the category change. But this is an old feature. 4) The category containment takes coercions into account: sage: P in Algebras(ZZ) True 5) After slight updates of the doctests, sage -testall -long passes. The bad news is that there is a slight performance loss. I did "sage - testall -long" twice, both for the original version of sage 4.5.2 and my experimental version. My experimental version has 0.1% more doctests, but the test time increased by an average of 1.5%. My impression is that a big change in the category framework, infiltrating many parts of Sage, should be discussed here. Do people think that a gain in flexibility provided by my additions to the category framework would justify a performance loss of 1.5%? Best regards, Simon -- 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