Regarding coding style

K

K Viltersten

I've been recommended reading of:
http://www.python.org/dev/peps/pep-0008/
and in there i saw two things that i
need to get elaborated.


1. When writing English, Strunk and
White apply.

Where can i download it? Am i actually
expected to read the whole book? How
many people actually do aply it?


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.


Thanks for the input in advance.
 
R

Richard Brodie

1. When writing English, Strunk and White apply.

Do they? I've never seen them ;)
2. You should use two spaces after a sentence-ending period.

For heavens sake, why?

Most people find it easier to type two spaces than one and a half.
 
D

D'Arcy J.M. Cain

I've been recommended reading of:
http://www.python.org/dev/peps/pep-0008/
and in there i saw two things that i
need to get elaborated.


1. When writing English, Strunk and
White apply.

Where can i download it? Am i actually
expected to read the whole book? How
many people actually do aply it?

"The Elements of Style" by William Strunk Jr. and E.B. White. The
original, revised edition was published in 1935. The third edition is
copyright 1979 and published by MacMillan Publishing Co., Inc., NY,
NY. There may be a later version with an ISBN but this one doesn't
have one.

It's a very small book, 4-1/2" by 7", 81 pages. If you are writing
English it is worth browsing from time to time.
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.

Like many things of this nature, the purpose is to follow the rules of
correct English usage.
 
D

D'Arcy J.M. Cain

I apply Fowler, PEP 8 be damned. ;-)

Fowler's is good too but much more comprehensive. Strunk and White is
a pamphlet compared to Fowler's tome.
 
J

Jeff Schwab

K said:
I've been recommended reading of:
http://www.python.org/dev/peps/pep-0008/
and in there i saw two things that i need to get elaborated.


1. When writing English, Strunk and White apply.

Where can i download it? Am i actually
expected to read the whole book?


It's a short book, and worth your time. Searching does turn up free
downloads, but I recommend the illustrated version (of which I own a copy).

http://www.libraryshop.org/elofstilbywi.html

How many people actually do aply it?

The problem is how many people don't.

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.

(a) It makes the ends of sentences more visually obvious.
(b) It makes text easier to parse reliably from scripts.
(c) Some text-editors can navigate such sentences out of the box,
whereas others cannot. (I recall this limitation with Emacs'
text-editing major mode, though it may have been fixed since then; I
switched to Vim about five years ago.)
 
J

Jon Ribbens

Like many things of this nature, the purpose is to follow the rules of
correct English usage.

Well, no, it's to follow a particular person's choice out of the many
and various competing rules of "correct English usage". Personally,
I dislike double spaces after sentences, but it is not wrong to put
them there any more than it is wrong not to put them there.
Consistency is far more important (hence the rule, I presume).
 
G

Grant Edwards

Personally, I dislike double spaces after sentences, but it is
not wrong to put them there any more than it is wrong not to
put them there.

You're lucky my high school typing teacher didn't hear you say
that...
 
K

K Viltersten

2. You should use two spaces after a
(a) It makes the ends of sentences more visually obvious.
(b) It makes text easier to parse reliably from scripts.
(c) Some text-editors can navigate such sentences out of
the box, whereas others cannot.

Got it. Thanks. :)
 
D

D'Arcy J.M. Cain

Well, no, it's to follow a particular person's choice out of the many
and various competing rules of "correct English usage". Personally,
I dislike double spaces after sentences, but it is not wrong to put
them there any more than it is wrong not to put them there.
Consistency is far more important (hence the rule, I presume).

Warning: Opinion follows possibly influenced by insufficient research.

I have read the arguments about single or double spacing and find that
they can be distilled down to the following:

You should use double space for monospaced fonts and single for
proportional. I reject this argument for two reasons. One is
consistency. It is entirely possible for the same document to be
rendered in multiple ways and you may not be aware of them ahead of
time. The second is that it seems to me that programs that use
proportional fonts should be able to make any space between sentences
render properly by their own rules so the number of spaces should be
irrelevant. I am not swayed by arguments that they don't handle this
properly yet.

The arguments for one over the other fall into these basic ones. Use
double spaces to make the document easier to read, especially by people
who read a lot and tend to skim to absorb as much information as
possible. Use single space because it makes the document display
nicer. This suggests to me that the schism is probably between two
different types of people, text/information oriented and
display/presentation oriented. I don't see any way to appeal to both.
 
K

K Viltersten

Personally, I dislike double spaces after
You're lucky my high school typing teacher
didn't hear you say that...

I'm unclear if your teacher was a double or
single spacer. It's only implied that he
felt strongly one way.
 
G

Grant Edwards

I'm unclear if your teacher was a double or single spacer.
Double.

It's only implied that he felt strongly one way.

She, actually. Leaving out one of the two spaces after the end
of a sentence was no less an error than leaving out the period
or forgetting to capitalize the first word of the next
sentence.

AFAIK, that's the way pretty much everybody was taught to type
back then (1977).

If you're using a word-processor or typesetting system that's
worth its weight in bits, it won't matter how many spaces you
type -- the paragraph layout algorithm will handle it.
 
J

Jeroen Ruigrok van der Werven

-On [20080307 19:10] said:
The arguments for one over the other fall into these basic ones. Use
double spaces to make the document easier to read, especially by people
who read a lot and tend to skim to absorb as much information as
possible. Use single space because it makes the document display
nicer. This suggests to me that the schism is probably between two
different types of people, text/information oriented and
display/presentation oriented. I don't see any way to appeal to both.

The double space came from the era of typewriters and monospace printers.
Technology nowadays with all kinds of rendering engines and font
specifications basically make the entire point of 'two spaces after a
period' a moot point.

In all my professional technical writing and documentation work I completely
gave up on two spaces after a period. It's archaic.

--
Jeroen Ruigrok van der Werven <asmodai(-at-)in-nomine.org> / asmodai
イェルーン ラウフロック ヴァン デル ウェルヴェン
http://www.in-nomine.org/ | http://www.rangaku.org/
When you are right, you cannot be too radical; When you are wrong, you
cannot be too conservative.
 
S

Steven D'Aprano

Like many things of this nature, the purpose is to follow the rules of
correct English usage.

Except English grammar does not and never has specified using two spaces
after a period. The (bad) habit of doing so was introduced by typists, in
the old days of manual typewriters, in the belief (completely bogus, in
my opinion) that a larger gap between sentences would make them more
readable. I believe that the larger gap is a distraction, one of the
reasons that typewriter text is generally harder to read than properly
typeset text.

I believe it is one of those things that everybody (for some value of
"everybody") does because that's what they were taught to do, and they
were taught to do it because that's what their teachers were taught, and
so on all the way back to some nutter who just decided that *he* was
going to use two spaces after a period because the Great and Mighty
Pumpkin told him to.

Professional typesetters, using proportional fonts, don't use double-
spaces because it throws off word spacing and line justification and just
plain looks ugly. I suppose that since coders typically use non-
proportional fonts, we can at least justify the use of two spaces with a
claim that it aids readability for "typewriter fonts" -- if you believe
such a thing, which I do not.
 
G

Grant Edwards

Professional typesetters, using proportional fonts, don't use double-
spaces because it throws off word spacing and line justification and just
plain looks ugly.

They do, however, put more space between sentences than they do
between words within a sentence. It is that practice which the
"two spaces after a period" rule in typewriting is attempting
to emulate.
I suppose that since coders typically use non- proportional
fonts, we can at least justify the use of two spaces with a
claim that it aids readability for "typewriter fonts" -- if
you believe such a thing, which I do not.

My thumb has been putting two spaces after a period for 30
years, so the chances that it's going to change are rather
slim. :)
 
R

Roberto Bonvallet

I believe it is one of those things that everybody (for some value of
"everybody") does because that's what they were taught to do

Actually I was never taught to, and I never learnt about it anywhere.
I started
to do it spontaneously in order to tell apart end-of-sentence periods
from abbreviation
periods. Anyway, I don't think it's something people should be forced
to do.
 
C

castironpi

Grant Edwards                   grante             Yow! A shapely CATHOLIC
                                  at               SCHOOLGIRL is FIDGETING
                               visi.com            inside my costume..

... Are you wearing it? *plonkblock*

So, what gets you plonked around h... *plonk*?
 
M

Micah Cowan

K Viltersten said:
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").
 
M

Micah Cowan

Grant Edwards said:
They do, however, put more space between sentences than they do
between words within a sentence. It is that practice which the
"two spaces after a period" rule in typewriting is attempting
to emulate.

Not in most books I've read. AFAICT, it's a (thankfully) disappearing
practice in the typesetting profession.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top