Hacker News new | past | comments | ask | show | jobs | submit login

Ah crap, say it ain't so. Never noticed that before (in the "Comments" section):

    "You should use two spaces after a sentence-ending period."



Most code is read in fixed-width fonts. I don't see why this is controversial. The argument to use only one space after a sentence-ending period only makes sense when reading in a variable-width font as the width of the space is corrected when rendered (and two spaces over-corrects).


No, extra space after a period is always in poor taste.

  Use a single word space between sentences. 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 asyour 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.
— Robert Bringhurst, The Elements of Typographic Style, 3rd Edition, §2.1.4

(Some people go as far as to recommend less than word space after a period or comma, since the blank area above the punctuation mark contributes to the total visual white space.)


Do any variable-width fonts actually do that? Looking at your comment, for example, the spaces after periods look the same width as those between words to my eye.


The em space fell out of favor when HTML got popular, because HTML renderers (ie. your browser) will strip extra spaces. So when looking at a web page, there actually is no difference between one and one hundred spaces (or two).


I'm not sure I'd call it controversial, but it is definitely a small annoyance because of muscle memory.

Anyway, in the grand scheme of things this is really insignificant :) The fact that PEP8 exists at all is just one of the things making Python great!


Ya. Seems like it would have been better if the implementation of variable-width fonts didn't goof and over-correct when presented with two spaces. As it is, they need to do something special when they see Mr. SoAndSo or Dr. SoAndSo, which would be, presumably, language-dependent. Then, everyone could always type two spaces after a sentence-ending period and it would always look good, regardless of whether it was rendered as fixed- or variable-width.


I thought only technology-illiterate people made that error. Very surprised to see that.


Or those of us who learned to type back in the days of Ye Typewriter.


It's supposed to be an em-space, not two normal spaces, but that is hard to to in ASCII.


vim does it by default (eg. when rewrapping a paragraph). I only recently discovered the nojoinspaces option to turn it off. Before that I was removing the extra space by hand all the time.


Say it ain't so...

:%s/\. /\. /g


It's not worth typing all that to remove one extra space. "/ ^Mx" is easier.


the command gJ does a join without the space logic.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: