[Tutor] Syntax error while attempting to type in multiline statements in the interactive interpreter

Ben Finney ben+python at benfinney.id.au
Sat Feb 4 19:16:36 EST 2017


boB Stepp <robertvstepp at gmail.com> writes:

> But would it not be more consistent to assume the user knows what he
> is doing based on the new (lack of) indentation being used, accept
> that a new section of code outside of the for loop is being typed in,
> and wait for the blank line before executing everything typed in?

That's not the purpose of the REPL. It is to Read (one statement),
Evaluate the statement, Print the result, and Loop.

You're wanting a different behaviour: wait until all the input has been
read, then evaluate it all.

If that's what you want: just write it all into a text file, and execute
that.

-- 
 \     “Nature is trying very hard to make us succeed, but nature does |
  `\       not depend on us. We are not the only experiment.” —Richard |
_o__)                                   Buckminster Fuller, 1978-04-30 |
Ben Finney



More information about the Tutor mailing list