Ian Lee added the comment:

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. 

    import unittest2
    import unittest

if sys.platform == 'win32':
    import foo


Python tracker <rep...@bugs.python.org>
Python-bugs-list mailing list

Reply via email to