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

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

Merged
merged 3 commits into from Jul 30, 2017

Conversation

Projects
None yet
2 participants
@ethanhs
Collaborator

ethanhs 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.

Support ImportFrom with module level getattr
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.
@ilevkivskyi

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 ...]?

@ethanhs

This comment has been minimized.

Show comment
Hide comment
@ethanhs

ethanhs Jul 30, 2017

Collaborator

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

Collaborator

ethanhs commented Jul 30, 2017

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

@ethanhs

This comment has been minimized.

Show comment
Hide comment
@ethanhs

ethanhs Jul 30, 2017

Collaborator

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

Collaborator

ethanhs commented Jul 30, 2017

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

@ilevkivskyi

This comment has been minimized.

Show comment
Hide comment
@ilevkivskyi

ilevkivskyi Jul 30, 2017

Collaborator

I will merge when tests pass.

Collaborator

ilevkivskyi commented Jul 30, 2017

I will merge when tests pass.

@ilevkivskyi

This comment has been minimized.

Show comment
Hide comment
@ilevkivskyi

ilevkivskyi Jul 30, 2017

Collaborator

I will merge when tests pass.

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

Collaborator

ilevkivskyi commented Jul 30, 2017

I will merge when tests pass.

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

@ethanhs

This comment has been minimized.

Show comment
Hide comment
@ethanhs

ethanhs Jul 30, 2017

Collaborator

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

Collaborator

ethanhs commented Jul 30, 2017

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

@ilevkivskyi ilevkivskyi merged commit 8294f42 into python:master Jul 30, 2017

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@ethanhs ethanhs deleted the ethanhs:getattr-importfrom branch Sep 25, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment