Skip to content

PEP 8: Consider removing "two spaces after period" #3024

Description

@erlend-aasland

Recently, we experienced an issue of wasted contributor time, wasted core dev time, and not to mention wasted CI resources because of core dev encouragement to revert an added sentence in the docs that did not use two spaces after a period. See python/cpython#102143 and python/cpython#102026 (comment).

The devguide says that one may use one or two spaces; it does not enforce either style.

In order to reduce churn, contributor confusion, and core dev confusion, I suggest to either remove the following sentence from PEP-8:

peps/pep-0008.txt

Lines 708 to 709 in 706b7aa

You should use two spaces after a sentence-ending period in multi-
sentence comments, except after the final sentence.

... or to make it similar to what the devguide advocates:

A sentence-ending period may be followed by one or two spaces

Activity

  1. CAM-Gerlach commented on Feb 23, 2023

    @CAM-Gerlach
    Member

    IMO, consistency is important for things that actually make a meaningful difference (source syntax, rendered output, etc), but I view period spacing (and similar spacing/line break issues) as too trivial to even make a one-click review suggestion for, much less open a whole new PR—and that's from someone who's close to as nitpicky as they come on docs formatting. We have a lifetime's worth of more important issues to worry about.

    Furthermore, while I understand the historical reasons for it (with Emacs, etc.), this sentence as it stands doesn't seem to really reflect the current reality, since grepping through Lib I found lots of instances of one-space after periods, particularly in more recent code and including plenty of that written by core developers.

    To note, we removed a similar sentence (and several other similarly prescriptive restrictions) in PEP 12 with PR #2374 , a change which, after a lengthy discussion, had a broad consensus behind it.

    I would just elide that line completely, since the rewrite following the devguide is just restating one of the universal basic rules for English typography (or really, most Latin-script—not sure any modern convention mandates zero or three+ spaces after periods) and it leads to a net decrease in prescriptive rules.

  2. Rosuav commented on Feb 23, 2023

    @Rosuav
    Contributor

    +1. Never been a fan of "two spaces after a full stop", since layout can handle that sort of thing better than content can.

  3. erlend-aasland commented on Feb 24, 2023

    @erlend-aasland
    ContributorAuthor
  4. gvanrossum commented on Feb 24, 2023

    @gvanrossum
    Member

    I’m fine with removing this recommendation as long as we don’t condemn two spaces. We don’t want to encourage a barrage of “remove extra space per PEP 8” PRs. The devguide wording is fine.

  5. hugovk commented on Feb 24, 2023

    @hugovk
    Member

    Like this?

    - You should use two spaces after a sentence-ending period in multi- 
    + You should use one or two spaces after a sentence-ending period in multi- 
      sentence comments, except after the final sentence. 
  6. JelleZijlstra commented on Feb 24, 2023

    @JelleZijlstra
    Member

    Maybe just remove the sentence? I doubt anyone is going to want to add three or zero spaces, so "one or two spaces" doesn't really add anything useful any more.

  7. gvanrossum commented on Feb 24, 2023

    @gvanrossum
    Member

    Since this is a known point of controversy, I'd like to see some language that explicitly endorses both forms and doesn't require consistency (not even within a paragraph), so as to discourage "contributions" that purport to "fix" something.

  8. erlend-aasland commented on Feb 24, 2023

    @erlend-aasland
    ContributorAuthor

    Thanks for the discussion. I'll open a PR with Hugo's suggestion, unless he beats me to it.

  9. CAM-Gerlach commented on Feb 25, 2023

    @CAM-Gerlach
    Member

    Since this is a known point of controversy, I'd like to see some language that explicitly endorses both forms and doesn't require consistency (not even within a paragraph), so as to discourage "contributions" that purport to "fix" something.

    Good point; we 100% don't want to generate more churn with people going back and forth with this, which would be counterproductive to the original motivation here.

  10. warsaw commented on Feb 26, 2023

    @warsaw
    Member

    I didn't get a chance to see this before it was merged and closed, but +1 for the change. I still use two spaces after sentence ending periods, but I think the requirement to do so is a bit of an anachronism.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions