-
-
Notifications
You must be signed in to change notification settings - Fork 163
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
Executors fail to recognize observable when function is not typehint #2449
Comments
@natestemen, I looked into this issue and it appears to be an issue when the When a function is passed into any of the
The This comes back to bite us in
During this part of the code, it is assumed that if If I correct the else if to be the following:
Then not using the typehint would result in the
Let me know your thoughts, but I see the solution to be:
|
Indeed, good catch. I've updated the issue title to reflect that fact. After trying to write this comment for a full 2 days, I'm convinced their isn't a solution that satisfies everyone. There are two issues at play;
I'm convinced resolving both of these issues without making a 'test call' to the users DocumentationThese suggestions are independent of code changes. The warnings should highlight what the needs are for our API.
Code
Footnotes
|
I like this idea @natestemen, to assume the user has defined a compatible executor when passing an observable. If the executor is not compatible, the user gets an error down the road that should make it clear the executor is not compatible. |
Turns out the |
The following snippet only works when the
execute
function has a typehint for the functions return type.The error that is raised when removing the typehint is
which comes from the
Executor
class. In particular a check to ensure the observable and return type of the executor are compatible.mitiq/mitiq/executor/executor.py
Lines 163 to 172 in 231319d
Needless to say, this code should work regardless of the typehint. If investigation shows that the typehint truly is needed, then this requirement needs to be documented.
The text was updated successfully, but these errors were encountered: