You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed the following in the QBayasian code where the use of a variable with the private naming ie leading underscore was flagged. As this is using what is normally considered implementation private and can be changed at any time it would be better to be relying on a supported public interface instead. (Raising an issue perhaps on qiskit to address this need if its not met elsewhere - which I kinda assume is the case due to the use of that private.)
Now I had to do a double take on the code snippet above as while it seemed to be doing a conditional check on the presence and accessing it in the if part - it goes ahead anyway and just accesses it in the else at the end. It seems on further research that the transpiler adds that so running the pass manager has the side-effect of creating it so it exists despite at first glance being wrong as its inside the else part. Some comments in the code would have been helpful - though to me anyway the use of a private member is rather suspect as the private variable is really an internal implementation detail that not being public and supported could be changed at any time.
Note: Code using the same private variable is present in several other files too where the same comment about its use applies.
The text was updated successfully, but these errors were encountered:
woodsp-ibm
changed the title
QBaysian uses private circuit attribute
Several classes, e.g QBaysian, use a private attribute of QuantumCircuit
May 30, 2025
woodsp-ibm
changed the title
Several classes, e.g QBaysian, use a private attribute of QuantumCircuit
Several modules, e.g QBaysian, use a private attribute of QuantumCircuit
May 30, 2025
Uh oh!
There was an error while loading. Please reload this page.
I noticed the following in the QBayasian code where the use of a variable with the private naming ie leading underscore was flagged. As this is using what is normally considered implementation private and can be changed at any time it would be better to be relying on a supported public interface instead. (Raising an issue perhaps on qiskit to address this need if its not met elsewhere - which I kinda assume is the case due to the use of that private.)
qiskit-machine-learning/qiskit_machine_learning/algorithms/inference/qbayesian.py
Lines 111 to 118 in c78e367
Now I had to do a double take on the code snippet above as while it seemed to be doing a conditional check on the presence and accessing it in the if part - it goes ahead anyway and just accesses it in the else at the end. It seems on further research that the transpiler adds that so running the pass manager has the side-effect of creating it so it exists despite at first glance being wrong as its inside the else part. Some comments in the code would have been helpful - though to me anyway the use of a private member is rather suspect as the private variable is really an internal implementation detail that not being public and supported could be changed at any time.
Note: Code using the same private variable is present in several other files too where the same comment about its use applies.
The text was updated successfully, but these errors were encountered: