Regarding coding style

Micah Cowan micah at cowan.name
Fri Mar 7 17:39:11 EST 2008


"K Viltersten" <tmp1 at viltersten.com> writes:

> 2. You should use two spaces after a sentence-ending period.
>
> For heavens sake, why? I've always been obstructed by the double
> blanks but tolerated them. Now, that i read that
> it actually is a recommendation, i need to ask about the purpose.

AFAICT from modern publications (which nevertheless get many other
things wrong, such as how f and i are handled when they appear in
sequence), this practice has mostly been eschewed, thankfully.

In "The Elements of Typographical Style", by Robert Bringhurst, has
this to say (section 2.1.4 of version 3.0):

   In the nineteenth century, which was a dark and inflationary age in
   typography and type design, many compositors were encouraged to
   stuff extra space between sentences. Generations of
   twentieth-century typists were then taught to do the same, by
   hitting the spacebar twice after every period. Your typing as well
   as your typesetting will benefit from unlearning this quaint
   Victorian habit. As a general rule, no more than a single space is
   required after a period, colon or any other mark of
   punctuation. Larger spaces (e.g., en spaces) are _themselves_
   punctuation.

He goes on to note that this does not apply to setting languages such
as classical Latin or Greek, or other circumstances in which sentences
begin with lowercase letters, where the extra space is actually
helpful.

The Elements of Typographical Style (much like Strunk & White) is not
gospel, but is written by a highly experienced typesetter, and is
chock full of very sound advice.

Personally, I find double-spacing to be an abomination. However, there
are some practical issues to note. One is that some editors (notably
vi) only recognize a period as ending a sentence if they are followed
by two spaces. This may be the default for Emacs as well (I don't do
much "moving by sentence" in Emacs). For this reason, the GNU Coding
Guidelines recommend ensuring that all periods in comments and in
plaintext documentation have periods.

Knuth's typesetting program, Τεχ, in its default "plain" format (and
in the popular Laτεχ format as well), will add extra space at the ends
of sentences automatically (I always disable this functionality when I
write for either of those; I believe the command is "\frenchspacing").

-- 
Micah J. Cowan
Programmer, musician, typesetting enthusiast, gamer...
http://micah.cowan.name/



More information about the Python-list mailing list