PEP 8 and extraneous whitespace
Thomas Jollans
t at jollybox.de
Thu Jul 21 14:32:02 EDT 2011
On 21/07/11 19:51, Andrew Berg wrote:
> Looks nice all lined up, but it violates PEP 8 because of those extra
> spaces, which is only because extra spaces look bad in one-line
> assignments that have nothing to do with lists/tuples or dictionaries.
> This is one of those times not to follow PEP 8 to the letter, but it
> does trip up checker programs (which are useful for catching silly
> things like an extra space at the end of a line or missing spaces around
> operators). Thoughts?
>
Read the PEP properly. Specifically this bit:
> - More than one space around an assignment (or other) operator to
> align it with another.
>
> Yes:
>
> x = 1
> y = 2
> long_variable = 3
>
> No:
>
> x = 1
> y = 2
> long_variable = 3
So, the PEP says: do not align operators. End of story.
More information about the Python-list
mailing list