Skip to content

Commit

Permalink
Piecewise lambdify printing for select uses lists instead of tuples. R…
Browse files Browse the repository at this point in the history
…esolves sympy/sympy#9747
  • Loading branch information
richardotis authored and skirpichev committed Sep 30, 2015
1 parent 69651b9 commit e117c60
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions sympy/printing/lambdarepr.py
Expand Up @@ -92,11 +92,9 @@ def _print_MatMul(self, expr):

def _print_Piecewise(self, expr):
"Piecewise function printer"
# Print tuples here instead of lists because numba may add support
# for select in nopython mode; see numba#1313 on github.
exprs = '({0},)'.format(','.join(self._print(arg.expr) for arg in expr.args))
conds = '({0},)'.format(','.join(self._print(arg.cond) for arg in expr.args))
# If (default_value, True) is a (expr, cond) tuple in a Piecewise object
exprs = '[{0}]'.format(','.join(self._print(arg.expr) for arg in expr.args))
conds = '[{0}]'.format(','.join(self._print(arg.cond) for arg in expr.args))
# If [default_value, True] is a (expr, cond) sequence in a Piecewise object
# it will behave the same as passing the 'default' kwarg to select()
# *as long as* it is the last element in expr.args.
# If this is not the case, it may be triggered prematurely.
Expand Down

0 comments on commit e117c60

Please sign in to comment.