gh-99087: Add missing newline for prompts in docs
https://github.com/python/cpython/issues/99087
This is against the recommendations by the dev guide: https://devguide.python.org/documentation/style-guide/#code-examples
Suggesting to close this PR.
I would argue that it does aid copy-pasting and is necessary despite impeding some readability: for example, in the enum howto, we have this:

which (when the >>> is clicked on the top-right of the code box) corresponds to the prompt
class Perm(IntFlag):
R = 4
W = 2
X = 1
RWX = 7
Perm.RWX
~Perm.RWX
Perm(7)
but this causes a error when pasted:
>>> class Perm(IntFlag):
... R = 4
... W = 2
... X = 1
... RWX = 7
... Perm.RWX
File "<stdin>", line 6
Perm.RWX
^^^^
SyntaxError: invalid syntax
This happens if the previous line is a part of something function, class, etc. when there's indentation, so the new line's needed to clear it out. I should have also put my justification in the description instead of leaving it empty - my bad on that.
I think the devguide paragraph @erlend-aasland cites isn't exactly on point here. It's about not introducing the secondary prompt to examples that currently don't have it, but this PR adds an extra line of secondary prompt to examples that already have it.
I should have also put my justification in the description instead of leaving it empty - my bad on that.
Yeah, either that, or creating an issue describing the problem. Perhaps an issue would have been appropriate here, since it is clearly not a trivial change.
The problem here is that the edit looks gross and makes the examples slightly longer, noisier, and less readable without adding anything substantive.
The problem here is that the edit looks gross and makes the examples slightly longer, noisier, and less readable without adding anything substantive.
Preventing errors from copy-pasting prompts, especially from howto pages, would quality as substantive to me, and since the edit is just extending the existing ... it doesn't appear that much visually intrusive. However, if the consensus is that prompts are to be left as-is intentionally, then I have no problem with closing this PR and pointing future PRs with similar changes to this one for justification.
I think this change is helpful [...]
I agree, it makes sense to me. I also think we should amend the dev guide.
FTR; the sqlite3 change is no longer relevant.
Deploy Preview for python-cpython-preview ready!
| Name | Link |
|---|---|
| Latest commit | db5bbe32feab90fd723f86a97874f189eef0f840 |
| Latest deploy log | https://app.netlify.com/sites/python-cpython-preview/deploys/63926a89e5beed0009ff7d1c |
| Deploy Preview | https://deploy-preview-98993--python-cpython-preview.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site settings.