code: def on_switch(self, memo, node):
      # -- pyll.base.switch is a control-flow expression.
      #
      #    It's signature is
      #       int, option0, option1, option2, ..., optionN
      #
      #    The semantics of a switch node are to only evaluate the option
      #    corresponding to the value of the leading integer. (Think of
      #    a switch block in the C language.)
      #
      #    This is a helper-function to self.eval_nodes.  It returns None,
      #    or a list of apply-nodes required to evaluate the given switch
      #    node.
      #
      #    When it returns None, the memo has been updated so that
      #    memo[`node`] has been assigned the computed value for the given
      #    switch node.
      #
      switch_i_var = node.pos_args[0]
      if switch_i_var in memo:
          switch_i = memo[switch_i_var]
          try:
              int(switch_i)
          except:
              raise TypeError("switch argument was", switch_i)
          if switch_i != int(switch_i) or switch_i < 0:
              raise ValueError(
                  "switch pos must be positive int", switch_i
              )
          rval_var = node.pos_args[switch_i + 1]
          if rval_var in memo:
              self.set_in_memo(memo, node, memo[rval_var])
              return
          else:
              return [rval_var]
      else:
          return [switch_i_var]
  
file_path: auptimizer/src/aup/Proposer/hyperopt/algobase.py
imports: from __future__ import print_function
  from builtins import object
  import copy
  from collections import deque
  import numpy
  from .None import pyll
  from .base import miscs_update_idxs_vals
label_desc: Use image node_id 4 for calling the ExprEvaluator obj's underlying member method code with example usage: obj.on_switch(memo, node) and returns: list, list