Skip to content

Commit

Permalink
join instead of string formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
whoburg committed Jan 5, 2024
1 parent 9856c89 commit d03aab3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions gpkit/constraints/single_equation.py
Expand Up @@ -13,7 +13,7 @@ class SingleEquationConstraint(ReprMixin):
def __init__(self, left, oper, right):
self.left, self.oper, self.right = left, oper, right

def str_without(self, excluded=("units")):
def str_without(self, excluded="units"):
"String representation without attributes in excluded list"
leftstr = try_str_without(self.left, excluded)
rightstr = try_str_without(self.right, excluded)
Expand All @@ -25,11 +25,11 @@ def str_without(self, excluded=("units")):
oper = self.unicode_opers[self.oper]
else:
oper = self.oper
return "%s %s %s" % (leftstr, oper, rightstr)
return " ".join((leftstr, oper, rightstr))

def latex(self, excluded=("units")):
def latex(self, excluded="units"):
"Latex representation without attributes in excluded list"
return ("%s %s %s" % (
return " ".join((
try_str_without(self.left, excluded, latex=True),
self.latex_opers[self.oper],
try_str_without(self.right, excluded, latex=True)))

0 comments on commit d03aab3

Please sign in to comment.