Skip to content

Update the type hints for QuantumCircuit.append #13617

@alexanderivrii

Description

@alexanderivrii

The QuantumCircuit.append method looks as follows

    def append(
        self,
        instruction: Operation | CircuitInstruction,
        qargs: Sequence[QubitSpecifier] | None = None,
        cargs: Sequence[ClbitSpecifier] | None = None,
        *,
        copy: bool = True,
    ) -> InstructionSet:

with the instruction being appended to a quantum circuit being of type Operation | CircuitInstruction.

In practice, however, we can add also anything that has a to_instruction method (see also this comment). It would be nice to reflect this functionality in the type hints and/or in the following docstring.

Metadata

Metadata

Assignees

Labels

documentationSomething is not clear or an error documentationgood first issueGood for newcomers

Type

No type

Projects

Status

Assigned

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions