class_docstr: Numpy printer which handles vectorized piecewise functions,
  logical operators, etc.
class_docstr_tok: ["Numpy","printer","which","handles","vectorized","piecewise","functions",",","logical","operators",",","etc","."]
docstr: Piecewise function printer
docstr_tok: ["Piecewise","function","printer"]
code: def _print_Piecewise(self, expr):
      "Piecewise function printer"
      from sympy.logic.boolalg import ITE, simplify_logic
  
      def print_cond(cond):
          """Problem having an ITE in the cond."""
          if cond.has(ITE):
              return self._print(simplify_logic(cond))
          else:
              return self._print(cond)
  
      exprs = "[{}]".format(
          ",".join(self._print(arg.expr) for arg in expr.args)
      )
      conds = "[{}]".format(
          ",".join(print_cond(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.
      return "{}({}, {}, default={})".format(
          self._module_format(self._module + ".select"),
          conds,
          exprs,
          self._print(S.NaN),
      )
  
imports: from sympy.core import S
  from sympy.core.function import Lambda
  from sympy.core.power import Pow
  from .pycode import PythonCodePrinter, _known_functions_math, _print_known_const, _print_known_func, _unpack_integral_limits, ArrayPrinter
  from .codeprinter import CodePrinter
label_desc: Use image node_id 17 for calling the NumPyPrinter obj's underlying member method code with example usage: obj._print_Piecewise(expr) and returns: str, self, self