Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
erlend-aasland opened this issue Feb 22, 2023 · 10 comments · Fixed by #3027
Closed

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

erlend-aasland opened this issue Feb 22, 2023 · 10 comments · Fixed by #3027

Comments

@erlend-aasland
Copy link
Contributor

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

@CAM-Gerlach
Copy link
Member

CAM-Gerlach commented Feb 23, 2023

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.

@Rosuav
Copy link
Contributor

Rosuav commented Feb 23, 2023

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

@erlend-aasland
Copy link
Contributor Author

cc. @gvanrossum & @warsaw

@gvanrossum
Copy link
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.

@hugovk
Copy link
Member

hugovk commented Feb 24, 2023

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. 

@JelleZijlstra
Copy link
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.

@gvanrossum
Copy link
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.

@erlend-aasland
Copy link
Contributor Author

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

@CAM-Gerlach
Copy link
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.

@warsaw
Copy link
Member

warsaw commented Feb 26, 2023

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
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants