Skip to content

Support from ... import ... with module level __getattr__ #3779

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

Merged
merged 3 commits into from
Jul 30, 2017

Conversation

emmatyping
Copy link
Member

@emmatyping emmatyping commented Jul 30, 2017

PEP 484 specifies one can def __getattr__(name): ... to specify that
unresolved names should be Any (or the return type of the __getattr__
method). This change adds support for access to these attributes via the
from module import name pattern. The module.name pattern is already
supported.

PEP 484 specifies one can def __getattr__(name): ... to specify that
unresolved names should be Any (or the return type of the getattr
method). This change adds support for access to these attributes via the
from module import name pattern. The module.name pattern is already
supported.
Copy link
Member

@ilevkivskyi ilevkivskyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! There is only one comment. Most empty lines in the tests could be removed (I am OK with them, but Guido really does not like them). Maybe only keep the empty lines before [file ...] and [case ...]?

@emmatyping
Copy link
Member Author

Ah, okay. I tried to keep it in the style, but perhaps I added too many. I'll make that change.

@emmatyping
Copy link
Member Author

Okay, I kept spaces between [file...], [case...], and [builtins...], to be consistent.

@ilevkivskyi
Copy link
Member

I will merge when tests pass.

@ilevkivskyi
Copy link
Member

I will merge when tests pass.

Except that they failed :-) Could you please fix the line numbers in the test output?

@emmatyping
Copy link
Member Author

Sorry about the line number problems. Should be good now!

@ilevkivskyi ilevkivskyi merged commit 8294f42 into python:master Jul 30, 2017
@emmatyping emmatyping deleted the getattr-importfrom branch September 25, 2017 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants