Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
allow tuples as category
Browse files Browse the repository at this point in the history
  • Loading branch information
dkrenn committed Sep 22, 2015
1 parent 08469c7 commit 98c252f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/sage/combinat/posets/cartesian_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,13 @@ def __init__(self, sets, category, order=None, **kwargs):
TESTS::
sage: P = Poset((srange(3), lambda left, right: left <= right))
sage: Cl = cartesian_product((P, P), order='notexisting')
sage: C = cartesian_product((P, P), order='notexisting')
Traceback (most recent call last):
...
ValueError: No order 'notexisting' known.
sage: C = cartesian_product((P, P), category=(Groups(),))
sage: C.category()
Join of Category of groups and Category of posets
"""
if order is None:
self._le_ = self.le_product
Expand All @@ -98,8 +101,11 @@ def __init__(self, sets, category, order=None, **kwargs):
else:
self._le_ = order

from sage.categories.category import Category
from sage.categories.posets import Posets
category = category & Posets()
if not isinstance(category, tuple):
category = (category,)
category = Category.join(category + (Posets(),))
super(CartesianProductPosets, self).__init__(
sets, category, **kwargs)

Expand Down

0 comments on commit 98c252f

Please sign in to comment.