PEP 8 and extraneous whitespace

Thomas Jollans t at jollybox.de
Mon Jul 25 19:26:09 EDT 2011


On 26/07/11 00:05, Ethan Furman wrote:
> Ed Leafe wrote:
>> Religious fervor is one thing; freedom of religion is another!  ;-)
>>
>> We strive for readability in our code, yet every printed material
>> designed to be read, such as books, newspapers, etc., uses a
>> proportional font.
> 
> The books I purchase use monospaced fonts for code examples.  Yours don't?

Strange that. Most do, but that's really just tradition.

I have Bjarne Stroustrup's "The C++ Programming Language" on my shelf,
and that prints code in a proportional font.

There are two possible reasons to prefer a monospaced font for code:

 1. You're used to it: tradition. This is a legacy of the era when
    computers simply didn't display proportional fonts.

 2. Your editor (my usual preference, Vim, is an example) doesn't
    support proportional fonts. This is a legacy of the era when
    computers simply didn't display proportional fonts.

Code is different from prose. We parse it so differently that printing
it in a monospaced font doesn't significantly hurt readability - but it
doesn't make it more readable either.

In the end, it really doesn't matter. This is probably why I enjoyed
writing this message so much.

Thomas



More information about the Python-list mailing list