]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
eja: fix element constructor error message for Cartesian products.
authorMichael Orlitzky <michael@orlitzky.com>
Tue, 23 Feb 2021 14:02:43 +0000 (09:02 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Tue, 23 Feb 2021 14:02:43 +0000 (09:02 -0500)
mjo/eja/eja_algebra.py

index 065339617b4b711dc52cd4a498cf59e59a6c18b1..7fb8027658bd7a407e52ab0525acd8a7470a3f6e 100644 (file)
@@ -3157,8 +3157,11 @@ class CartesianProductEJA(CombinatorialFreeModule_CartesianProduct,
             e(0, 1) + e(1, 2)
         """
         m = len(self.cartesian_factors())
-        z = tuple( self.cartesian_factors()[i](elt[i]) for i in range(m) )
-        return self._cartesian_product_of_elements(z)
+        try:
+            z = tuple( self.cartesian_factors()[i](elt[i]) for i in range(m) )
+            return self._cartesian_product_of_elements(z)
+        except:
+            raise ValueError("not an element of this algebra")
 
     Element = FiniteDimensionalEJAElement