-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecate bind_parameters
in favor of assign_parameters
#10792
Conversation
One or more of the the following people are requested to review this:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks pretty much solid to me, thanks Elena!
releasenotes/notes/deprecate-bind-parameters-283c94069e8a9142.yaml
Outdated
Show resolved
Hide resolved
…yaml Co-authored-by: Jake Lishman <jake@binhbar.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me now, thanks Elena. I'm strongly expecting that we'll get some complaints about people wishing we'd use one name over the other, but since assign_parameters
is the superset of functionality of bind_parameters
, the decision was already made for us.
(And personally I prefer assign
anyway haha)
# TODO: delete once bind_parameters is removed from the codebase | ||
warnings.filterwarnings("ignore", category=DeprecationWarning) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This appears to need the manual override because of the getattr
call changing the stack depth of the deprecated access, right? We could rewrite the test to avoid needing this, but it's probably cleanest just to leave it the way you have.
... as `bind_parameters` has been deprecated (Qiskit/qiskit#10792)
... as `bind_parameters` has been deprecated (Qiskit/qiskit#10792)
Summary
Fixes #7057 (unless there is any strong argument to keep both methods in Qiskit 1.0).
Fix #8958
Details and comments
bind_parameters
was only used in a couple of places internally. I went through these to make sure that we would not need any additional checks for the assigned values (asbind_parameters
would fail forParameterExpression
s):Sampler, Estimator, BackendSampler, BackendEstimator
_expand_parameters
inqiskit/compiler/assembler.py
DefaultUnitarySynthesis
transpiler passUnrollForLoops
transpiler passI don't think these checks would be needed, but let me know if you disagree.
I was also unsure about modifying the
qiskit.algorithms
related code, as it is going to be removed anyway, but honestly the search and replace was pretty much 0 effort compared to catching the deprecation warnings or creating exceptions in the test case. I have in any case done this in a separate commit in case we think it should be reverted.