Skip to content

Commit fce2622

Browse files
eric-wieserutensil
authored andcommitted
Remove dead code (#189)
This code is unreachable, because the contract of `cls.__mul__(a, b)` is that `isinstance(a, cls)` is _always_ `True`
1 parent 8f2e91f commit fce2622

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

galgebra/mv.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1652,7 +1652,7 @@ def __rsub__(self, sdop):
16521652

16531653
def __mul__(self, sdopr):
16541654
sdopl = self
1655-
if isinstance(sdopl, Sdop) and isinstance(sdopr, Sdop):
1655+
if isinstance(sdopr, Sdop):
16561656
if sdopl.Ga != sdopr.Ga:
16571657
raise ValueError('In Sdop.__mul__ Sdop arguments are not from same geometric algebra')
16581658
terms = []
@@ -1662,13 +1662,8 @@ def __mul__(self, sdopr):
16621662
terms += Dsdopl
16631663
product = Sdop(terms, ga=sdopl.Ga)
16641664
return Sdop.consolidate_coefs(product)
1665-
else:
1666-
if not isinstance(sdopl, Sdop): # sdopl is a scalar
1667-
terms = [(sdopl * x[0], x[1]) for x in sdopr.terms]
1668-
product = Sdop(terms, ga=sdopr.Ga) # returns Sdop
1669-
return Sdop.consolidate_coefs(product)
1670-
else: # sdopr is a scalar or a multivector
1671-
return sum([x[0] * x[1](sdopr) for x in sdopl.terms], S(0)) # returns scalar
1665+
else: # sdopr is a scalar or a multivector
1666+
return sum([x[0] * x[1](sdopr) for x in sdopl.terms], S(0)) # returns scalar
16721667

16731668
def __rmul__(self,sdop):
16741669
terms = [(sdop * x[0], x[1]) for x in self.terms]

0 commit comments

Comments
 (0)