-
-
Notifications
You must be signed in to change notification settings - Fork 30k
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
Generate LOAD_ATTR+CALL_FUNCTION instead of LOAD_METHOD+CALL_METHOD for imports #88479
Comments
import foo
def func():
return foo.bar() The snippet above will generate the following code; 2 0 LOAD_GLOBAL 0 (foo) Though this will make things harder for specializing the LOAD_ATTR for modules since now the handling of LOAD_METHOD for that case is necessary so for the imports that we can infer during the symbol analysis pass, we'll generate LOAD_ATTR+CALL_ATTR instead of LOAD_METHOD+CALL_METHOD and hopefully the generated code will get specialized via the PEP-659. |
@mark.shannon what do you think about doing this both for |
Yes. Simpler is good. I think it will also be better for performance: In general, we don't know what X is in However, if we are accessing an attribute it is quite likely to be a module or class. If it is a string, int or function then it is rare to call a method on it, so we can ignore that case. For a module, For a class, specializing Overall, it looks like |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: