|View source on GitHub|
The recursive type consumed by circuit builder methods.
cirq.ops.op_tree.OpTree( *args, **kwargs )
An OpTree is a type protocol, satisfied by anything that can be recursively flattened into Operations. We also define the Union type OP_TREE which can be an OpTree or just a single Operation.
- An Operation is an OP_TREE all by itself.
- A list of operations is an OP_TREE.
- A list of tuples of operations is an OP_TREE.
- A list with a mix of operations and lists of operations is an OP_TREE.
- A generator yielding operations is an OP_TREE.
OP_TREE = Union[Operation, Iterable['OP_TREE']]
__iter__() -> Iterator[Union[Operation, 'OpTree']]