From: Michael Orlitzky Date: Fri, 26 Jul 2019 16:10:48 +0000 (-0400) Subject: eja: use an insane hack to hide the (left_)matrix methods for elements. X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=d6e8006679a55e9d2f0da3e8400963dfdcfb3283;p=sage.d.git eja: use an insane hack to hide the (left_)matrix methods for elements. --- diff --git a/mjo/eja/euclidean_jordan_algebra.py b/mjo/eja/euclidean_jordan_algebra.py index 4b46380..6400485 100644 --- a/mjo/eja/euclidean_jordan_algebra.py +++ b/mjo/eja/euclidean_jordan_algebra.py @@ -340,6 +340,16 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra): An element of a Euclidean Jordan algebra. """ + def __dir__(self): + """ + Oh man, I should not be doing this. This hides the "disabled" + methods ``left_matrix`` and ``matrix`` from introspection; + in particular it removes them from tab-completion. + """ + return filter(lambda s: s not in ['left_matrix', 'matrix'], + dir(self.__class__) ) + + def __init__(self, A, elt=None): """ EXAMPLES: @@ -862,6 +872,16 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra): return self.span_of_powers().dimension() + def left_matrix(self): + """ + Our parent class defines ``left_matrix`` and ``matrix`` + methods whose names are misleading. We don't want them. + """ + raise NotImplementedError("use operator_matrix() instead") + + matrix = left_matrix + + def minimal_polynomial(self): """ Return the minimal polynomial of this element,