Closed ampolloreno closed 6 years ago
A tuple can represent an instruction. For example, ('X', 5)
represents the Quil instruction X 5
. The method inst
also takes lists of instructions. ['X', 5]
is malformed since it's not a list of instructions. It doesn't error earlier, however, since pyQuil allows raw instructions inst
ed as strings.
You can get this error more straightforwardly by doing:
>>> p = Program()
>>> q = p.alloc()
>>> p.inst(q)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/robert/Slash/anaconda/lib/python2.7/site-packages/pyquil/quilbase.py", line 309, in inst
raise TypeError("Invalid instruction: {}".format(instruction))
File "/Users/robert/Slash/anaconda/lib/python2.7/site-packages/pyquil/resource_manager.py", line 83, in __str__
return str(self.index())
File "/Users/robert/Slash/anaconda/lib/python2.7/site-packages/pyquil/resource_manager.py", line 76, in index
raise RuntimeError("Can't get the index of an unassigned qubit.")
RuntimeError: Can't get the index of an unassigned qubit.
I would say this is an issue because of bad condition checking / bad error message.
Is this expected behavior?