Circuit.batch_insert(insertions: Iterable[Tuple[int, Union[cirq.ops.raw_types.Operation, Iterable[Any]]]]) → None[source]

Applies a batched insert operation to the circuit.

Transparently handles the fact that earlier insertions may shift
the index that later insertions should occur at. For example, if you
insert an operation at index 2 and at index 4, but the insert at index 2
causes a new moment to be created, then the insert at “4” will actually
occur at index 5 to account for the shift from the new moment.

All insertions are done with the strategy ‘EARLIEST’.

When multiple inserts occur at the same index, the gates from the later
inserts end up before the gates from the earlier inserts (exactly as if
you’d called list.insert several times with the same index: the later
inserts shift the earliest inserts forward).
Parameters:insertions – A sequence of (insert_index, operations) pairs indicating operations to add into the circuit at specific places.