Python Opcodes

Introduction

Using the Python opcode family, you can interact with a Python3 interpreter embedded in Csound in five ways:

  1. Initialize the Python interpreter (the pyinit opcodes),
  2. Run a statement (the pyrun opcodes),
  3. Execute a script (the pyexec opcodes),
  4. Invoke a callable and pass arguments (the pycall opcodes),
  5. Evaluate an expression (the pyeval opcodes), or
  6. Change the value of a Python object, possibly creating a new Python object (the pyassign opcodes);

and you can do any of these things:

  1. At i-time or at k-time,
  2. In the global Python namespace, or in a namespace specific to an individual instance of a Csound instrument (local or "l" context),
  3. And can you can retrieve from 0 to 8 return values from callables that accept N parameters.

...this means that there are many Python-related opcodes. But all of these opcodes share the same py prefix, and have a regular naming scheme:

"py" + [optional context prefix] + [action name] + [optional x-time suffix]