summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/act4e_solutions/sets_product.py20
1 files changed, 2 insertions, 18 deletions
diff --git a/src/act4e_solutions/sets_product.py b/src/act4e_solutions/sets_product.py
index 42b8640..508fd45 100644
--- a/src/act4e_solutions/sets_product.py
+++ b/src/act4e_solutions/sets_product.py
@@ -19,7 +19,7 @@ class MyFiniteSetProduct(I.FiniteSetProduct[C, E]):
return prod(map(lambda c: c.size(), self._components))
def contains(self, x: E) -> bool:
- if type(x) != type(self._components):
+ if not isinstance(x, Iterable):
return False
if len(x) != len(self._components):
@@ -27,6 +27,7 @@ class MyFiniteSetProduct(I.FiniteSetProduct[C, E]):
for (e, s) in zip(x, self._components):
if not s.contains(e):
+ print(f"{s} does not contain {e}")
return False
return True
@@ -42,26 +43,9 @@ class MyFiniteSetProduct(I.FiniteSetProduct[C, E]):
def save(self, h: I.IOHelper, x: E) -> I.ConcreteRepr:
return cast(I.ConcreteRepr, x)
- # raise NotImplementedError
- # return {"elements": [e for e in self.elements()]}
def load(self, h: I.IOHelper, o: I.ConcreteRepr):
return cast(E, o)
- # raise NotImplementedError
- # if not isinstance(o, dict):
- # raise I.InvalidFormat()
-
- # if not "elements" in o:
- # raise I.InvalidFormat()
-
- # nsets = len(o["elements"][0])
- # components = [[] for _ in range(nsets)]
- # for elements in o["elements"]:
- # for c, e in zip(components, elements):
- # if not e in c:
- # c.append(e)
-
- # return MyFiniteSetProduct(components)
# Product behaviour
def components(self) -> Sequence[I.FiniteSet[C]]: