From: Michael Orlitzky Date: Fri, 6 Nov 2020 13:44:07 +0000 (-0500) Subject: eja: document why an a[0] access is safe. X-Git-Url: http://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=28ec09b5c64dd7a342a3ae8b35f809cc185d9c63;p=sage.d.git eja: document why an a[0] access is safe. --- diff --git a/mjo/eja/eja_algebra.py b/mjo/eja/eja_algebra.py index 0492946..ded2df6 100644 --- a/mjo/eja/eja_algebra.py +++ b/mjo/eja/eja_algebra.py @@ -1006,8 +1006,10 @@ class MatrixEuclideanJordanAlgebra(FiniteDimensionalEuclideanJordanAlgebra): # we simply undo the basis_normalizer scaling that we # performed earlier. # - # TODO: make this access safe. - XS = a[0].variables() + # The a[0] access here is safe because trivial algebras + # won't have any basis normalizers and therefore won't + # make it to this "else" branch. + XS = a[0].parent().gens() subs_dict = { XS[i]: self._basis_normalizers[i]*XS[i] for i in range(len(XS)) } return tuple( a_i.subs(subs_dict) for a_i in a )