Hi Nicolas,

Thanks a lot for these hints! I need to implement a category of multi-graded modules/algebras over a Hopf algebra (the Steenrod algebra, specifically), so I thought subclassing AlgebrasWithBasis would be a good idea... I've now followed your example instead, and it all seems to work.

(I did notice that there already is a category for graded modules, but it seems to be largely empty. I suppose that framework is still in the making.)

Cheers,
Christian

On 05/21/2011 06:43 PM, Nicolas M. Thiery wrote:
        Hi Christian,

On Fri, May 20, 2011 at 10:10:37AM +0200, Christian Nassau wrote:
I would like to create a new category that's derived from
AlgebrasWithBasis, but I get an infinite recursion when I ask for the
CartesianProducts:

Here's a simple example:

    class MyAlgebrasWithBasis(AlgebrasWithBasis):
       def __init__(self,R):
         AlgebrasWithBasis.__init__(self,R)

Is your intention to create a subcategory of AlgebrasWithBasis? That
is a category whose objects are algebras with basis, possibly endowed
with more structure? If yes, the idiom is:


     class AlgebrasWithBasis(Category_over_base_ring):

        @cached_method
        def super_categories(self):
            return [AlgebrasWithBasis(self.base_ring())]

        ...

Otherwise, please describe precisely your use case to see what we
should do with it (fix the issue, raise a better warning, ...). Note
that at this point, the hierarchy of classes for categories is
basically flat:

     Category
      - Sets
      - Semigroups
      - Fields
      - ...
      - Category_over_base_ring
        - Modules
        - Algebras
        - ...

Best,
                                Nicolas
--
Nicolas M. ThiƩry "Isil"<nthi...@users.sf.net>
http://Nicolas.Thiery.name/


--
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

Reply via email to