Currently, the Python REPL will always give a ...
prompt after any block of code - even if the suite is provided on the same line:
>>> if 1: print("Hello")
...
Hello
Having extra code after that block is invalid in the old REPL; with the new REPL (3.13+), it’s legal, and not part of the block:
Python 3.11.2 (main, Apr 28 2025, 14:11:48) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> if 0: print("Hello")
... print("world")
File "<stdin>", line 2
print("world")
^^^^^
SyntaxError: invalid syntax
>>>
Python 3.15.0a0 (heads/main:e7a3c20b925, Jun 13 2025, 01:15:48) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> if 0: print("Hello")
... print("world")
...
world
>>>
Is it reasonable for the REPL to detect that the code block is complete, and immediately execute it rather than waiting for further text?
If the “continue writing code after the block” behaviour is desired, the most straight-forward way to do this is to add another layer to the code:
>>> if 1:
... if 0: print("Hello")
... print("world")
...
world
>>>
which works in all versions. Usually that’s not something I’d be looking for when writing code in a single line though.