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

Commit

Permalink
allow kwargs in CartesianProduct (to be used in inherited classes)
Browse files Browse the repository at this point in the history
  • Loading branch information
dkrenn committed Jun 2, 2015
1 parent 7b098f7 commit c6a01f8
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/sage/sets/cartesian_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class CartesianProduct(UniqueRepresentation, Parent):
.. automethod:: _cartesian_product_of_elements
"""
def __init__(self, sets, category, flatten=False):
def __init__(self, sets, category, flatten=False, **kwargs):
r"""
INPUT:
Expand All @@ -62,6 +62,8 @@ def __init__(self, sets, category, flatten=False):
``flatten`` is current ignored, and reserved for future use.
No other keyword arguments (``kwargs``) are accepted.
TESTS::
sage: from sage.sets.cartesian_product import CartesianProduct
Expand All @@ -71,7 +73,14 @@ def __init__(self, sets, category, flatten=False):
sage: C.an_element()
(1/2, 1, 1)
sage: TestSuite(C).run()
sage: cartesian_product([ZZ, ZZ], blub=None)
Traceback (most recent call last):
...
TypeError: unknown parameters: blub
"""
if kwargs:
raise TypeError('unknown parameters: %s' %
', '.join(str(k) for k in kwargs.iterkeys()))
self._sets = tuple(sets)
Parent.__init__(self, category=category)

Expand Down

0 comments on commit c6a01f8

Please sign in to comment.