# What do the numbers of the operation object in QuantumCircuit.data outputs?

When you have a quantum circuit and use QuantumCircuit.data you get a list with objects of this type (this is the one for a X gate acting on qubit 0 y a 2 qubits Quantum Circuit):

(qiskit.extensions.standard.x.XGate object at 0x0000019B8DEC2EB8, [Qubit(QuantumRegister(2, 'q'), 0)], [])

The first element represents the operation. What does the sequence of digits 0x0000019B8DEC2EB8 mean? I suppose it has something to do with the location or the time, but I do not know how to obtain each digit. I need to know exactly how to reproduce one of these sequences myself.

Thank you so much in advance.

That is the address in memory (represented as a hexademical number) of that specific gate object. It can be used to differentiate that specific X gate object from a different X gate object. Other than that it general is not useful, and it's definitely not something you would ever need to manually reproduce.

• Thank you! Really good explanation. Mar 4, 2020 at 19:08

These numbers are memory addresses of the Gate objects in python. Instances of any python class will have them (though they may not always be shown):

>>> class B():
...   def __init__(self):
...     pass
...
>>> B()
<__main__.B object at 0x106e63d30>
>>> B()
<__main__.B object at 0x106e63da0>


They don't have any meaning in the context of the QuantumCircuit and they'll essentially be random every time you recreate your circuit. (Really, they shouldn't be included in the display of the Gate object).

Why do you need to know how to reproduce these sequences? There's probably another way to accomplish your goal.

• I need a way to identify that this information corresponds to the x gate so I can use a conditional if to assign the corresponding x matrix to a new variable x=np.array([0,1],[1,0]). I have managed to do this using qasm. The problem comes when you have, for example, a u3 gate as qasm gives you a string of the form u3(3.14159265358979,3.14159265358979,3.14159265358979) (for qc.u3(np.pi,np.pi,np.pi,0)). So this is not a list but a string so I have to extract the corresponding numbers and convert their corresponding string to floats. Mar 4, 2020 at 19:56