Circuit.prev_moment_operating_on(qubits: Sequence[cirq.ops.raw_types.Qid], end_moment_index: Optional[int] = None, max_distance: Optional[int] = None) → Optional[int][source]

Finds the index of the next moment that touches the given qubits.

  • qubits – We’re looking for operations affecting any of these qubits.
  • end_moment_index – The moment index just after the starting point of the reverse search. Defaults to the length of the list of moments.
  • max_distance – The number of moments (starting just before from the end index and moving backward) to check. Defaults to no limit.

None if there is no matching moment, otherwise the index of the latest matching moment.


ValueError – negative max_distance.