This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author IanLee1521
Recipients IanLee1521, docs@python, ncoghlan, terry.reedy
Date 2014-12-22.06:04:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1419228280.63.0.0650862735677.issue23061@psf.upfronthosting.co.za>
In-reply-to
Content
So one concern that was brought up on GitHub was the fact that currently this is not actually followed universally in the Python standard library. In particular there are 636 errors in the standard library ``python pep8.py --select E402 --statistics /usr/lib/python3.4``.

The vast majority are due to issues with dunder definitions ``__{all,author,copyright,credits,version,etc...}__`` before the imports. A lesser cause is imports in the middle of files. ``Lib/tokenize.py`` has pretty much all of these issues. In particular ``__all__`` is specifically mentioned that it should be declared AFTER the imports by PEP-8. That said, I would argue this is a good time to clean up that code in the standard library.

Additionally, its possible that there might need to be some wording in the PEP about intermixing "try,except,else,finally" and possibly "if,elif,else" into the imports. E.g. 

```
try: 
    import unittest2
except:
    import unittest
```

```
if sys.platform == 'win32':
    import foo
```
History
Date User Action Args
2014-12-22 06:04:40IanLee1521setrecipients: + IanLee1521, terry.reedy, ncoghlan, docs@python
2014-12-22 06:04:40IanLee1521setmessageid: <1419228280.63.0.0650862735677.issue23061@psf.upfronthosting.co.za>
2014-12-22 06:04:40IanLee1521linkissue23061 messages
2014-12-22 06:04:39IanLee1521create