violation of iterator protocol for Statevector #8039
Labels
bug
Something isn't working
good first issue
Good for newcomers
mod: quantum info
Related to the Quantum Info module (States & Operators)
stable backport potential
The bug might be minimal and/or import enough to be port to stable
Milestone
Environment
What is happening?
When iterating over a Statevector in a foor loop, data is attempted to be accessed after the last element.
How can we reproduce the issue?
Leads to
What should happen?
EITHER:
iter
resp .remove__iter__
(i.e. disable iteration)Adopting the latter would result in behavior like this:
Leads to
without any errors.
Any suggestions?
Since this iteration style is considered pythonic, it would be nice to have a proper iterator.
I suspect the iterator might be simply forwarded form the internal representation of the data.
Maybe also check other data types for this behavior?
The text was updated successfully, but these errors were encountered: