ClassicalRegister.__getitem__

ClassicalRegister.__getitem__(key)
Arg:

bit_type (Qubit or Clbit): a constructor type return element/s. key (int or slice or list): index of the clbit to be retrieved.

Returns

a Qubit or Clbit instance if key is int. If key is a slice, returns a list of these instances.

Return type

Qubit or Clbit or list(Qubit) or list(Clbit)

Raises
  • CircuitError – if the key is not an integer.

  • QiskitIndexError – if the key is not in the range (0, self.size).