-
-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
Some missing newlines for prompts #99087
Comments
Making it easier to copy & paste is a valid point, in my opinion. I find the style guide a little hard to interpret regarding the secondary prompt:
|
It should be noted that C&P is only a problem when pasting into the REPL. |
Regarding this:
Is that argument still valid? The |
I find that whole sentence kinda confusing. It's not clear to me what's being copied/cut, it is not clear to me what the existing difficulties the dev guide points to are, it's not clear to me if the dev guide suggests pasting into a source file or into the REPL prompt... |
Hmm, yeah, readers can't cut. Only copy. I believe:
The code, with or without the extra
The
Both. The extra |
Let me be slightly more accurate: for examples where Sphinx implicitly adds prompts to the rendered output, you can choose to display the prompts or to hide them. Example from the Versus: Trying to copy and paste from the former into the REPL of course results in a disaster. Trying to copy and paste from the latter into the REPL is less a disaster, but results in a syntax error. However, if you paste the latter into a new source file, you'll be able to run it without problems. |
You assume you know what is being copied and where it is being copied. These details matter, hence my initial comments. If you click the upper right |
Let's get back to the problem that Stanley has highlighted: If a doctest-style1 example is missing an empty line or a single ellipsis prompt, the user may run into syntax errors if they copy and paste code into the REPL, even if they disable the prompts (using the Footnotes
|
No, I'm assuming that the |
Regarding the dev guide. Before
Possible improvement (shot in the dark)
|
I prefer not to assume, and I prefer docs to not assume things either. Explicit docs are to be preferred. That goes both for the user docs (docs.python.org) and for the dev guide. |
Add newline for prompts so copying to REPL does not cause errors.
For example, in the enum howto (source) becomes
but when pasted into the prompt, gives
There are a number of such examples that could use a newline with
...
for ease of pasting.#98993
Linked PRs
The text was updated successfully, but these errors were encountered: