Regarding coding style

Discussion in 'Python' started by K Viltersten, Mar 7, 2008.

  1. K Viltersten

    K Viltersten Guest

    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.

    --
    Regards
    Konrad Viltersten
    --------------------------------
    sleep - a substitute for coffee for the poor
    ambition - lack of sense to be lazy
     
    K Viltersten, Mar 7, 2008
    #1
    1. Advertising

  2. On Fri, Mar 7, 2008 at 4:31 PM, K Viltersten <> wrote:
    >
    > 1. When writing English, Strunk and
    > White apply.


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

    --
    Cheers,
    Simon B.

    http://www.brunningonline.net/simon/blog/
     
    Simon Brunning, Mar 7, 2008
    #2
    1. Advertising

  3. "K Viltersten" <> wrote in message
    news:...

    > 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.
     
    Richard Brodie, Mar 7, 2008
    #3
  4. On Fri, 7 Mar 2008 17:31:35 +0100
    "K Viltersten" <> wrote:
    > 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'Arcy J.M. Cain <> | Democracy is three wolves
    http://www.druid.net/darcy/ | and a sheep voting on
    +1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.
     
    D'Arcy J.M. Cain, Mar 7, 2008
    #4
  5. On Fri, 7 Mar 2008 16:44:10 +0000
    "Simon Brunning" <> wrote:
    > On Fri, Mar 7, 2008 at 4:31 PM, K Viltersten <> wrote:
    > >
    > > 1. When writing English, Strunk and
    > > White apply.

    >
    > 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.

    --
    D'Arcy J.M. Cain <> | Democracy is three wolves
    http://www.druid.net/darcy/ | and a sheep voting on
    +1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.
     
    D'Arcy J.M. Cain, Mar 7, 2008
    #5
  6. K Viltersten

    Jeff Schwab Guest

    K Viltersten wrote:
    > 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.)
     
    Jeff Schwab, Mar 7, 2008
    #6
  7. K Viltersten

    Jon Ribbens Guest

    On 2008-03-07, D'Arcy J.M. Cain <> wrote:
    >> 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.


    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).
     
    Jon Ribbens, Mar 7, 2008
    #7
  8. On 2008-03-07, Jon Ribbens <> wrote:

    > 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...

    --
    Grant Edwards grante Yow! I joined scientology
    at at a garage sale!!
    visi.com
     
    Grant Edwards, Mar 7, 2008
    #8
  9. K Viltersten

    K Viltersten Guest

    SV: Regarding coding style

    >> 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.


    Got it. Thanks. :)

    --
    Regards
    Konrad Viltersten
    --------------------------------
    sleep - a substitute for coffee for the poor
    ambition - lack of sense to be lazy
     
    K Viltersten, Mar 7, 2008
    #9
  10. On 7 Mar 2008 17:40:08 GMT
    Jon Ribbens <> wrote:
    > 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.

    --
    D'Arcy J.M. Cain <> | Democracy is three wolves
    http://www.druid.net/darcy/ | and a sheep voting on
    +1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.
     
    D'Arcy J.M. Cain, Mar 7, 2008
    #10
  11. K Viltersten

    K Viltersten Guest

    SV: Regarding coding style

    >> 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...


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

    --
    Regards
    Konrad Viltersten
    --------------------------------
    sleep - a substitute for coffee for the poor
    ambition - lack of sense to be lazy
     
    K Viltersten, Mar 7, 2008
    #11
  12. Re: SV: Regarding coding style

    On 2008-03-07, K Viltersten <> wrote:

    >>> 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...

    >
    > 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.

    --
    Grant Edwards grante Yow! I'm having fun
    at HITCHHIKING to CINCINNATI
    visi.com or FAR ROCKAWAY!!
     
    Grant Edwards, Mar 7, 2008
    #12
  13. -On [20080307 19:10], D'Arcy J.M. Cain () wrote:
    >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.
     
    Jeroen Ruigrok van der Werven, Mar 7, 2008
    #13
  14. On Fri, 07 Mar 2008 11:58:38 -0500, D'Arcy J.M. Cain wrote:

    >> 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.


    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.



    --
    Steven
     
    Steven D'Aprano, Mar 7, 2008
    #14
  15. On 2008-03-07, Steven D'Aprano <> wrote:

    > 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. :)

    --
    Grant Edwards grante Yow! A shapely CATHOLIC
    at SCHOOLGIRL is FIDGETING
    visi.com inside my costume..
     
    Grant Edwards, Mar 7, 2008
    #15
  16. K Viltersten

    Aahz Guest

    In article <>,
    Grant Edwards <> wrote:
    >
    >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. :)


    +1 QOTW
    --
    Aahz () <*> http://www.pythoncraft.com/

    "All problems in computer science can be solved by another level of
    indirection." --Butler Lampson
     
    Aahz, Mar 7, 2008
    #16
  17. On Mar 7, 6:16 pm, Steven D'Aprano <st...@REMOVE-THIS-
    cybersource.com.au> wrote:
    > 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.

    --
    Roberto Bonvallet
     
    Roberto Bonvallet, Mar 7, 2008
    #17
  18. K Viltersten

    Guest

    > 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*?
     
    , Mar 7, 2008
    #18
  19. K Viltersten

    Micah Cowan Guest

    "K Viltersten" <> 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/
     
    Micah Cowan, Mar 7, 2008
    #19
  20. K Viltersten

    Micah Cowan Guest

    Grant Edwards <> writes:

    > On 2008-03-07, Steven D'Aprano <> wrote:
    >
    >> 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.


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

    --
    Micah J. Cowan
    Programmer, musician, typesetting enthusiast, gamer...
    http://micah.cowan.name/
     
    Micah Cowan, Mar 7, 2008
    #20
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Paul Baxter

    style for coding latches

    Paul Baxter, Aug 10, 2003, in forum: VHDL
    Replies:
    7
    Views:
    1,145
    Mike Treseler
    Aug 15, 2003
  2. calmar
    Replies:
    11
    Views:
    899
    calmar
    Feb 21, 2006
  3. Replies:
    2
    Views:
    460
    krushi
    Nov 6, 2006
  4. jmfauth
    Replies:
    2
    Views:
    226
    jmfauth
    Nov 23, 2010
  5. Ken Varn
    Replies:
    0
    Views:
    471
    Ken Varn
    Apr 26, 2004
Loading...

Share This Page