Skip to content

Inconsistencies in instruction attributes #598

Description

@thierry-martinez

Instruction attributes have several inconsistencies across the API:

  • Instruction.CNOT is constructed as Instruction.CNOT(target, control), whereas Circuit.cnot(control, target). The same is true for RZZ and CCX.
  • Instruction.CZ is constructed as Instruction.CZ((u, v)), whereas Circuit.cz(u, v).

It seems less error-prone to use the same argument order everywhere (and the usual convention seems to be to put the control qubits first).

As for tuple v. expanded arguments, the situation is less clear. I think I prefer CCX(target=0, controls=(1, 2)) and ccx.controls[1] over CCX(target=0, control0=1, control1=2) and ccx.control1. The names control0 and control1 (or target0 and target1) seem more ad hoc.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions