The "loop and a half"
bartc
bc at freeuk.com
Fri Oct 6 20:05:50 EDT 2017
On 07/10/2017 00:43, Steve D'Aprano wrote:
> On Sat, 7 Oct 2017 12:24 am, bartc wrote:
>
>> print ("Enter blank expression to quit.")
>
>
> I *despise* programs that do that, and would cheerfully and unapologetically
> take their designers, disguise them as a lettuce, and stake them out to be
> nibbled to death by snails.
>
> At the interactive prompt, I am frequently hitting Enter on a blank line,
> either by accident, or deliberately to break up the calculations into groups,
> or just to give myself time to think.
>
> Blank lines should be treated as "do nothing" and simply ignored, and there
> should be an explicit QUIT command.
Um, that actually follows what interactive Python does. If you type this
(I'm using <<< as the prompt as >>> confuses my newsreader's quoting
system):
<<< def fn():
<<< pass
<<< pass
At this point, you can break out by pressing the key for 'eof', or by
pressing Enter at the start of a line. Even though a blank line is legal
Python syntax.
(Most of my real interactive programs with a command line interface
programs use Escape, quit, exit, q or x to finish.
Interactive Python requires quit() or exit(), complete with parentheses.
Unless you've redefined quit and exit as something else, then you have
to crash out by other means.)
--
bartc
More information about the Python-list
mailing list