Changes between Version 15 and Version 16 of PythonGuidelines


Ignore:
Timestamp:
Apr 14, 2010 12:44:13 PM (10 years ago)
Author:
Chris Jerdonek
Comment:

Clarified suggested import ordering style guideline.

Legend:

Unmodified
Added
Removed
Modified
  • PythonGuidelines

    v15 v16  
    3737
    3838 * Prefer single quotes to double quotes.  Use double quotes only if the string contains single quotes (or if you are using "triple double quotes").  This makes cutting and pasting from the console easier since Python itself behaves this way when rendering string values to the console.
    39  * Order `from` and `import` statements by the name of the leading module instead of putting all `from` statements before `import` statements:
     39 * Order `from` and `import` statements within a group by the name of the leading module instead of putting all `from` statements before `import` statements:
    4040{{{
    4141# Correct:
     
    4949import sys
    5050}}}
    51  This keeps the ordering of lines the same when changing a `from` statement to an `import` statement, and vice versa.  This also makes it easer to see if both `from` and `import` statements are used to import from the same package (since the lines will be adjacent).
     51 This keeps the ordering of lines the same when changing a `from` statement to an `import` statement, and vice versa.  This also makes it easer to see if both `from` and `import` statements are used to import from the same package (since the lines will be adjacent).  By "within a group," we mean in the PEP8 sense of grouping standard library imports separately from local application imports, etc.
    5252
    5353== Upgrading from Python 2.3 or Python 2.4 ==