On 07/10/2017 09:35, Steve D'Aprano wrote:
On Sat, 7 Oct 2017 11:05 am, bartc wrote:

Um, that actually follows what interactive Python does.


What is "that" to which you refer?

If you mean, "what I, Bart C, suggested, namely having the program exit on a
blank line", then you are wrong. In the Python interactive interpreter, you
can enter blank lines, and the interpreter doesn't exit.

There's one priviso: blank lines are only ignored at the primary prompt >>>
not the secondary prompt ... where a blank line is used to end the block. But
the interpreter doesn't exit. A slight compromise for the sake of convenience
at the interactive prompt.

That's what I mean. Enter is used to end one state and get back to another.

The same thing with my loop evaluating expressions. When you're done with with expressions, you might exit in the trivial example, or you might get back to a main command loop. Just like Python.


(Most of my real interactive programs with a command line interface
programs use Escape, quit, exit, q or x to finish.

And how do you distinguish between calling quit from inside the function, and
using quit inside the function?

Huh? Most interactive programs aren't language interpreters like Python, where everything needs to be considered to be a line in the language syntax.

Unfortunately ESCAPE is already used. VT100 (the terminal emulation which is
used in just about all terminals) all control sequences begin with ESC. So
every time you do something like press an arrow key, the terminal sends ESC
followed by other stuff. It would be painful if every time you hit an arrow
key, the interpreter took it as "Exit".

Yes, I discovered this. So my programs that use Escape on Windows needed to use Escape Escape on Linux to get around that.

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.)

"Crash out", he says.

If your intention is to prove that you're a know-nothing ignoramus, you're
doing an excellent job of it.

Yes, crash out. I've always considered control sequences as something out of the ordinary used when things go wrong. Eg:

 <<< while 1:
 <<<     pass
 <<<

Here it appears to hang, and nothing you type does anything except (on Windows) Ctrl-C. That's what I call crashing out. Although that stays within the interpreter. If I press Ctrl-Break instead, it aborts the interpreter too.

What exactly is your problem, that anyone who has a different take on things must be an 'ignoramus'? And, to boot, an ignoramus who knows nothing?

--
bartc
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to