From 82d3e5bb067d73eb0aa557d234da0f9723b456e8 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Fri, 12 Mar 2021 08:11:47 -0500 Subject: [PATCH] eja: use hasattr() to avoid a try/except. --- mjo/eja/eja_algebra.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/mjo/eja/eja_algebra.py b/mjo/eja/eja_algebra.py index 8e52252..4a1c6f9 100644 --- a/mjo/eja/eja_algebra.py +++ b/mjo/eja/eja_algebra.py @@ -779,13 +779,9 @@ class FiniteDimensionalEJA(CombinatorialFreeModule): if elt.parent().superalgebra() == self: return elt.superalgebra_element() - try: - # Try to convert a vector into a column-matrix... + if hasattr(elt, 'column'): + # Convert a vector into a column-matrix... elt = elt.column() - except (AttributeError, TypeError): - # and ignore failure, because we weren't really expecting - # a vector as an argument anyway. - pass if elt not in self.matrix_space(): raise ValueError(msg) -- 2.43.2