Cirq icon indicating copy to clipboard operation
Cirq copied to clipboard

Update `cirq.qasm` documentation to clarify that qubits should be supplied only when `val` does not already know it's qubits.

Open ArfatSalman opened this issue 2 years ago • 8 comments

Description of the issue

The cirq.qasm [docs] expects an optional qubits kw-args. But specifying it throws an error.

It seems like this line picks the AbstractCircuit's _qasm_ argument, which is not expecting anything.

If qubits is given an incorrectly-typed argument, then I was expecting a different error message.

How to reproduce the issue


import cirq

qr = [cirq.NamedQubit("q_" + str(i)) for i in range(2)]

circuit = cirq.Circuit()

circuit.append(cirq.rz(3)(qr[0]))

# As per the docs, qubits are "A list of qubits that the value is being applied to."
qasm = cirq.qasm(circuit, qubits=[qr[0]])

print(qasm)
# TypeError: AbstractCircuit._qasm_() got an unexpected keyword argument 'qubits'


TypeError: AbstractCircuit.qasm() got an unexpected keyword argument 'qubits'

Cirq version

1.1.0

ArfatSalman avatar Feb 22 '23 11:02 ArfatSalman