qrisp.lock#
- lock(qubits)[source]#
Locks a list of qubits, implying an error will be raised if the user tries to perform any operation involving these qubits.
This can be reversed by calling unlock.
- Parameters:
- qubitslist[Qubit] or QuantumVariable
The list of Qubits to lock.
Examples
We create a QuantumChar, lock it’s Qubits and attempt to initialize.
>>> from qrisp import QuantumChar, lock >>> q_ch = QuantumChar() >>> lock(q_ch) >>> q_ch[:] = "g" Exception: Tried to operation on locked qubits