Arcane question regarding white space, editors, and code collapsing

Steven D'Aprano steven at REMOVE.THIS.cybersource.com.au
Thu Nov 19 02:06:07 CET 2009


On Thu, 19 Nov 2009 10:56:35 +1100, Ben Finney wrote:

> Wells <wells at submute.net> writes:
> 
>> Is it... pythonic, then, to have these lines of tabs/spaces to support
>> code collapsing? Is it proper, improper, or irrelevant?
> 
> It's quite improper (though syntactically null, in Python) to have
> trailing whitespace on lines. That includes blank lines.

Blank lines are far from improper in Python, they're recommended by PEP 8.


> One major reason is that trailing whitespace causes spurious invisible
> differences between otherwise-identical lines when doing an automatic
> comparison, which is done quite a lot in collaboration and version
> control.

Then you need better comparison software that doesn't give so many false 
matches due to insignificant differences.


> Fix your text editor (which may entail switching to a better text
> editor) to respect blank lines and the conventions of the language.

Yes, if the editor's handling of code collapsing is broken, it needs to 
be fixed, or replaced.


-- 
Steven



More information about the Python-list mailing list