#11943: The category graph should comply with Python's method resolution order
---------------------------+------------------------------------------------
Reporter: SimonKing | Owner: nthiery
Type: enhancement | Status: new
Priority: major | Milestone: sage-4.7.3
Component: categories | Keywords: category graph, method resolution
order
Work_issues: | Upstream: N/A
Reviewer: | Author:
Merged: | Dependencies:
---------------------------+------------------------------------------------
Comment(by SimonKing):
With the new test, I found a bug in algebra_ideals:
{{{
sage: C = AlgebraIdeals(FreeAlgebra(QQ,2,'a,b'))
sage: C.parent_class
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (396, 0))
---------------------------------------------------------------------------
TypeError Traceback (most recent call
last)
/home/king/Seminar/<ipython console> in <module>()
/mnt/local/king/SAGE/broken/local/lib/python2.6/site-
packages/sage/misc/lazy_attribute.pyc in __get__(self, a, cls)
507 if a is None: # when doing cls.x for cls a class and x a
lazy attribute
508 return self
--> 509 result = self.f(a)
510 if result is NotImplemented:
511 # Workaround: we make sure that cls is the class
/mnt/local/king/SAGE/broken/local/lib/python2.6/site-
packages/sage/categories/category.pyc in parent_class(self)
626 """
627 return
dynamic_class("%s.parent_class"%self.__class__.__name__,
--> 628 tuple(cat.parent_class for cat in
self.super_categories()),
629 self.ParentMethods,
630 reduction = (getattr, (self,
"parent_class")))
/mnt/local/king/SAGE/broken/local/lib/python2.6/site-
packages/sage/misc/cachefunc.pyc in __call__(self, *args, **kwds)
553 return self.cache[k]
554 except KeyError:
--> 555 w = self._cachedmethod._instance_call(self._instance,
*args, **kwds)
556 self.cache[k] = w
557 return w
/mnt/local/king/SAGE/broken/local/lib/python2.6/site-
packages/sage/misc/cachefunc.pyc in _instance_call(self, inst, *args,
**kwds)
776
777 """
--> 778 return self._cachedfunc.f(inst, *args, **kwds)
779
780 def _get_instance_cache(self, inst):
/mnt/local/king/SAGE/broken/local/lib/python2.6/site-
packages/sage/categories/algebra_ideals.pyc in super_categories(self)
67 [Category of algebra modules over Univariate
Polynomial Ring in x over Rational Field]
68 """
69 from algebra_modules import AlgebraModules
70 R = self.algebra()
---> 71 return [AlgebraModules(R)]
/mnt/local/king/SAGE/broken/local/lib/python2.6/site-
packages/sage/misc/classcall_metaclass.pyc in __call__(cls, *args,
**options)
256 return cls.__classcall_private__(cls, *args,
**options)
257 elif hasattr(cls, "__classcall__"):
--> 258 return cls.__classcall__(cls, *args, **options)
259 else:
260 return type.__call__(cls, *args, **options)
/mnt/local/king/SAGE/broken/local/lib/python2.6/site-
packages/sage/misc/cachefunc.pyc in __call__(self, *args, **kwds)
176 return self.cache[k]
177 except KeyError:
--> 178 w = self.f(*args, **kwds)
179 self.cache[k] = w
180 return w
/mnt/local/king/SAGE/broken/local/lib/python2.6/site-
packages/sage/structure/unique_representation.pyc in __classcall__(cls,
*args, **options)
447 True
448 """
--> 449 instance = type.__call__(cls, *args, **options)
450 assert isinstance( instance, cls )
451 if instance.__class__.__reduce__ ==
UniqueRepresentation.__reduce__:
/mnt/local/king/SAGE/broken/local/lib/python2.6/site-
packages/sage/categories/algebra_modules.pyc in __init__(self, A)
53 from sage.categories.commutative_algebras import
CommutativeAlgebras
54 if not hasattr(A, "base_ring") or not A in
CommutativeAlgebras(A.base_ring()):
---> 55 raise TypeError, "A (=%s) must be a commutative
algebra"%A
56 Category_module.__init__(self, A)
57
TypeError: A (=Free Algebra on 2 generators (a, b) over Rational Field)
must be a commutative algebra
}}}
Thus, apparently, that category has never been used.
The problem is that the super categories of the category of algebra ideals
should be the category of algebra modules. However, while the former
accepts non-commutative algebras, the latter wants to see commutative
algebras.
The clean way to proceed would be: Make algebra modules work over non-
commutative rings. If that is too much of work, C.super_categories()
should be `[]` if C is the category of algebra ideals over a non-
commutative rings.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11943#comment:1>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.