Ever since the scalar type of QuantumCircuit.data changed from a 3-tuple of (Operation, list[Qubit], list[Clbit]) to the record-like CircuitInstruction in #8093, we've maintained the iterable interfaces as a legacy format that makes it appear tuple-like for the purposes of for inst, qargs, cargs in qc.data and such.
The new-style format has been around two years now and using the legacy format involves memory and runtime penalties (to allocate new lists rather than re-using the same interned tuples). We should deprecate the legacy interface pending removal in Qiskit 2.0 to push any remaining users onto the modern form.
Ever since the scalar type of
QuantumCircuit.data
changed from a 3-tuple of(Operation, list[Qubit], list[Clbit])
to the record-likeCircuitInstruction
in #8093, we've maintained the iterable interfaces as a legacy format that makes it appear tuple-like for the purposes offor inst, qargs, cargs in qc.data
and such.The new-style format has been around two years now and using the legacy format involves memory and runtime penalties (to allocate new lists rather than re-using the same interned tuples). We should deprecate the legacy interface pending removal in Qiskit 2.0 to push any remaining users onto the modern form.