white space in expressions and argument lists

Magnus Lycka lycka at carmen.se
Fri Mar 3 12:41:35 EST 2006


Sybren Stuvel wrote:
> Scott David Daniels enlightened us with:
> 
>>One reason is such code changes too much on code edits, which makes
>>code differences hard to read.
> 
> Good point. I'll keep it in mind :)

Think particularly about using version management systems
and applying patches coming from different sources etc.

Touching more lines of code than you actually need will
both make it difficult for a reviewer to understand what
has changed (although good diff tools can be told to
ignore pure whitespace changes) and it will also increase
the risk of conflicts in the version management system if
several people are editing the same code.

Finally, if you end up with something like...

a                                        = 1
b                                        = 5
df                                       = 7
ew                                       = 5
qw                                       = 7
a2                                       = 5
a4                                       = 7
d3                                       = 5
df                                       = 7
this_is_a_very_long_variable_name_indeed = 42

...it's *not* easier to see what the value of
e.g. a4 is than if you had just used one space
between the variable name and the =.

As usual, Guido is right, even if it isn't
obvious at first unless you are Dutch. ;^)



More information about the Python-list mailing list