[Python-Dev] PEP 8 updates/clarifications

skip@pobox.com skip at pobox.com
Tue Dec 13 05:22:33 CET 2005


    >> I looked at that too, but most of these didn't jump out at me.  I'll 
    >> copy in the parts that aren't already in PEP 8 that seem possible:
    >> 
    >> From-imports should follow non-from imports.  Dotted imports should
    >> follow non-dotted imports.  Non-dotted imports should be grouped by
    >> increasing length, while dotted imports should be grouped roughly
    >> alphabetically.
    >> 
    >> This seems too complex to me for PEP 8.

    Barry> Really?  ISTR adopting this convention from Guido, but I'm not
    Barry> 100% sure about that.  After having used it for several years
    Barry> now, I do really like this style, but I'm willing to leave the
    Barry> recommendation out of PEP 8.

This is subjective enough that I would think some rationale explaining this
convention should be given.  Personally, I group imports into three sections
as follows:

    * Python core modules/packages

    * Third-party modules/packages

    * Local modules/packages

I can't explain why I do it that way.  I guess it just satisfies some inner
hobgoblin.

Skip



More information about the Python-Dev mailing list