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
Relax __all__ location requirement in PEP 8 #71374
Comments
PEP-8 says: Put any relevant __all__ specification after the imports. I don't remember why we wanted __all__ to go after imports. I think we should relax that since other dunders can go before imports. See related PYCQA issue: PyCQA/pycodestyle#394 |
I think that it should be updated to specify that all dunders ('__all__', '__version__', '__author__', etc) should be placed after the module docstring and before any imports. See issue-27187-patch1.txt for a possible update. |
I might also suggest that the entire "Version bookkeeping" section could be removed in this case, as it would be covered by my newly added dunder section. |
I added a comment on a pull request related to this that shows some of the cases that we probably don't want to allow: PyCQA/pycodestyle#523 (comment) |
New changeset cf8e888b9555 by Barry Warsaw in branch 'default': |
Thanks for the patch! |
The revised text says __dunder__ should appear before any imports, however __future__ imports must appear first for obvious reasons. Does this need to be mentioned in the pep? |
Good catch. I'm uploading a new patch that addresses |
Thanks Ian. I'm going to apply that, but rephrase it a bit. |
__future__
importsNote: 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: