pyjuice.nodes.foreach

pyjuice.nodes.foreach(func: Callable, root_ns: CircuitNodes)

Traverse all nodes of a PC and can a specific function.

Note:

An alternative is to use the iterator directly via the for statement. See below for an example.

Parameters:
  • func (Callable) – the function to be called

  • root_ns (CircuitNodes) – the root PC node

Example::
>>> for ns in root_ns: # Traverse the PC bottom-up
...     [do something...]
>>> for ns in root_ns(reverse = True): # Traverse the PC top-down
...     [do something...]