qiskit/releasenotes/notes/1.0/add-annotated-arg-to-contro...

19 lines
791 B
YAML

---
features_circuits:
- |
Added a new argument, ``annotated``, to the methods :meth:`.QuantumCircuit.control`, :meth:`.Gate.control`
and ``.control()`` methods of :class:`.Gate` subclasses (such as :class:`.UnitaryGate` or :class:`.SwapGate`)
to optionally return an :class:`.AnnotatedOperation`.
The default value of ``annotated`` is ``False`` and corresponds to the pre-existing behavior of the method,
for example::
SwapGate().control(1, annotated=False)
returns a :class:`.CSwapGate` while::
SwapGate().control(2, annotated=False)
returns a ``ControlledGate``. When ``annotated=True``, the methods return an object of
type :class:`~.AnnotatedOperation` instead, avoiding the eager construction of the controlled gate's definition.