qiskit-documentation/docs/api/qiskit/0.43/qiskit.circuit.Bit.mdx

49 lines
2.4 KiB
Plaintext

---
title: Bit
description: API reference for qiskit.circuit.Bit
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit.circuit.Bit
---
# Bit
<Class id="qiskit.circuit.Bit" isDedicatedPage={true} github="https://github.com/qiskit/qiskit/tree/stable/0.24/qiskit/circuit/bit.py" signature="Bit(register=None, index=None)" modifiers="class">
Bases: `object`
Implement a generic bit.
<Admonition title="Note" type="note">
This class should not be instantiated directly. This is just a superclass for [`Clbit`](qiskit.circuit.Clbit "qiskit.circuit.Clbit") and [`Qubit`](qiskit.circuit.Qubit "qiskit.circuit.Qubit").
</Admonition>
Create a new generic bit.
## Attributes
### index
<Attribute id="qiskit.circuit.Bit.index">
Get the index of an old-style bit in the register that owns it.
In modern Qiskit Terra (version 0.17+), bits are the fundamental object and registers are aliases to collections of bits. A bit can be in many registers depending on the circuit, so a single containing register is no longer a property of a bit. It is an error to access this attribute on bits that were not constructed as “owned” by a register.
<Admonition title="Deprecated since version 0.17" type="danger">
The property `qiskit.circuit.bit.Bit.index` is deprecated as of qiskit-terra 0.17. It will be removed no earlier than 3 months after the release date. Instead, use `find_bit()` to find all the containing registers within a circuit and the index of the bit within the circuit.
</Admonition>
</Attribute>
### register
<Attribute id="qiskit.circuit.Bit.register">
Get the register of an old-style bit.
In modern Qiskit Terra (version 0.17+), bits are the fundamental object and registers are aliases to collections of bits. A bit can be in many registers depending on the circuit, so a single containing register is no longer a property of a bit. It is an error to access this attribute on bits that were not constructed as “owned” by a register.
<Admonition title="Deprecated since version 0.17" type="danger">
The property `qiskit.circuit.bit.Bit.register` is deprecated as of qiskit-terra 0.17. It will be removed no earlier than 3 months after the release date. Instead, use `find_bit()` to find all the containing registers within a circuit and the index of the bit within the circuit.
</Admonition>
</Attribute>
</Class>