-
Notifications
You must be signed in to change notification settings - Fork 180
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
Globally imported dunders are implicitly used. #645
Conversation
... to support e.g. importing `__version__` from an autogenerated submodule.
I'm -1 -- add these to |
As discussed in #387 (comment) adding them to |
|
I agree, but that's what |
not entirely, it's also for documenting the "public" names of a namespace (tab completion, doc generation, etc.) |
Fair, but note that https://www.python.org/dev/peps/pep-0008/#module-level-dunder-names specifically does not consider |
yeah it also imports |
It's not a very serious example, but it's also the only thing (AFAICT) in the reference docs that addresses this point... |
I'm also a fairly strong -1 on this. |
To be clear, this is not really about |
Yes, I understand that. Your argument against what seems to be a common practice is potential use of an uncommon one that's strongly recommended against |
Well, another argument given above is that PEP8 explicitly does not add edit: Also, it is not clear to me why you think the behavior proposed here would be harmful; i.e., do you think it can ever give rise to incorrectly missed warnings? To be clear, I am more than willing to restrict the special-casing to |
This is not a convincing argument. The PEP was a point-in-time capture of how to write code for the standard library which
There are many projects that use There seems to be little possibility for anything other than an absolute increase in maintainer-burden by accepting some variant of this pull request. |
My second point in my previous message is that this is with high confidence an invalid lint, and that it artificially forces a perfectly valid single-statement construct to be split into two statements for the sole purpose of satisfying pyflakes. (On top of that, the two statements will typically have to be far away from one another as one will be in the imports block whereas the other defines a global variable.)
I would argue that the increase is not large (and is counterbalanced by a real usability improvement), although I am obviously not a maintainer, so my judgment hardly matters here. |
... to support e.g. importing
__version__
from an autogeneratedsubmodule.
Closes #387.
I chose to skip all dunders (per https://www.python.org/dev/peps/pep-0008/#module-level-dunder-names), but I can also just special-case
__version__
, whatever you prefer.