Qiskit / qiskit

Qiskit is an open-source SDK for working with quantum computers at the level of extended quantum circuits, operators, and primitives.
https://www.ibm.com/quantum/qiskit
Apache License 2.0
4.83k stars 2.29k forks source link

Deprecate legacy iterable access to `CircuitInstruction` #12631

Closed jakelishman closed 1 week ago

jakelishman commented 1 week ago

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.