[issue9618] IDLE shell ignores all but first statement

Terry J. Reedy report at bugs.python.org
Fri Aug 20 20:15:32 CEST 2010


Terry J. Reedy <tjreedy at udel.edu> added the comment:

In interactive mode, multiline statements are terminated with a blank line. Your examples lacks that, so the 3rd line is part of the def and lacking the proper indent, is indeed a syntax error. You get the same with the standard command-line interpreter.
>>> def f():
...     return 42
... f()
  File "<stdin>", line 3
    f()
    ^
SyntaxError: invalid syntax

That said, adding a blank line still gives a syntax error in IDLE, instead of ignoring the extra statement, while the interpreter prints 42. IDLE requires an explicit blank line from the keyboard to terminate compound statements; pasted blank lines do not count #3559 (which I now see you commented on - I should have been notified but was not).

I suspect you are correct about the dependency on code.InteractiveConsole(), but I have not looked at the IDLE code either.

In the meanwhile, either paste multiple statements in the the real interpreter or into an IDLE window and use F5 run.

----------
nosy: +terry.reedy
type:  -> feature request
versions:  -Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9618>
_______________________________________


More information about the Python-bugs-list mailing list