netqasm.lang.subroutine

NetQASM subroutine definitions.

This module contains the Subroutine class which represents a static (not being executed) NetQASM subroutine.

class netqasm.lang.subroutine.Subroutine(instructions=None, arguments=None, netqasm_version=(0, 10), app_id=None)

Bases: object

A Subroutine object represents a subroutine consisting of valid instructions, i.e. objects deriving from NetQASMInstruction.

Subroutines can optionally have arguments, which are yet-to-be-defined variables that are used in one or more of the instructions in the Subroutine. So, a Subroutine can be seen as a function which takes certain parameters (arguments). Concrete values for arguments can be given by instantiating (using the instantiate method).

`Subroutine`s are executed by `Executor`s.

Parameters:
  • instructions (Optional[List[NetQASMInstruction]])

  • arguments (Optional[List[str]])

  • netqasm_version (Tuple[int, int])

  • app_id (Optional[int])

property netqasm_version: Tuple[int, int]
property app_id: int | None
property instructions: List[NetQASMInstruction]
property arguments: List[str]
instantiate(app_id, arguments=None)
Parameters:
  • app_id (int)

  • arguments (Optional[Dict[str, int]])

Return type:

None

property cstructs