import qiskit
qiskit.__version__

from qiskit.circuit.library import XGate
gate = XGate()
print(f"name: {gate.name}\n")
print(f"params: {gate.params}\n")
print(f"matrix:\n{gate.to_matrix()}\n")
print(f"definition:\n{gate.definition}\n")

new_gate = XGate()
print(f"name: {gate.name}\n")
print(f"params: {gate.params}\n")
print(f"matrix:\n{gate.to_matrix()}\n")
print(f"definition:\n{gate.definition}\n")

XGate() is XGate() is XGate() is XGate() is XGate() is XGate() is XGate() is XGate() is XGate() is XGate()

try:
    XGate().label = "My Extra Special XGate made with secret sauce"
except NotImplementedError as e:
    print(e)

labelled_gate = XGate(label="My Extra Special XGate made with secret sauce")
print(labelled_gate.label)
print(f"Shared object: {labelled_gate is XGate()}")

gate = XGate()
gate.mutable

mutable_gate = gate.to_mutable()
mutable_gate.label = "My Extra Special XGate made with secret sauce"
print(mutable_gate.label)
print(f"Shared object: {mutable_gate is XGate()}")

from qiskit.circuit import Clbit
gate = XGate()
conditional_gate = gate.c_if(Clbit(), 0)
print(conditional_gate.condition)
print(f"Shared object: {conditional_gate is XGate()}")

from qiskit.circuit import QuantumCircuit
qc = QuantumCircuit(1, 1)
qc.x(0).c_if(qc.clbits[0], 1)
print(qc)

print(qc.data[0].operation is XGate())

