Circuit.pop

Circuit.pop(point=None)[source]

Pop the operation at point, defaults to last operation.

Parameters:

point (CircuitPointLike | None) – The cycle and qudit index to pop from.

Returns:

The popped operation is returned.

Return type:

Operation

Raises:

IndexError – If the point is out-of-range, or if no operation exists at point.

Examples

>>> from bqskit.ir.gates import HGate
>>> circ = Circuit(1)
>>> circ.append_gate(HGate(), [0])
>>> circ.num_operations
1
>>> circ.pop((0, 0))
HGate@(0,)
>>> circ.num_operations
0