[Python-ideas] Off topic: 'strike a balance' - second language English
jfine2358 at gmail.com
Tue Aug 21 14:29:06 EDT 2018
Chris Angelico wrote
> Where in the linked-to What's New page is there an example of that?
> There are several code blocks that ARE copy/pasteable, even into the
> vanilla interpreter.
Good question. The reddit user wrote.
Take this example for re.sub. [https://docs.python.org/3/library/re.html#re.sub]
Trying that out requires 3 separate copy and pastes just to do one
example. Or you have to put it in an intermediate file, clean it up
then paste it in. The examples are also grouped by sub function not by
what they do.
I think the problem is the user didn't see the [>>>] toggle at the top
right of the code block. I know I didn't just now, when I tried it
just now. It was only the strength of your assertion, Chris, that made
me go back and try again.
In the following examples, input and output are distinguished by the
presence or absence of prompts (>>> and …): to repeat the example, you
must type everything after the prompt, when the prompt appears; lines
that do not begin with a prompt are output from the interpreter. Note
that a secondary prompt on a line by itself in an example means you
must type a blank line; this is used to end a multi-line command.
No mention here, or elsewhere on the page, that [>>>] at the top
right of a code example toggles the presence or absence of prompts.
More information about the Python-ideas