[issue29339] Interactive: Move to same indentation level as previous line
Terry J. Reedy
report at bugs.python.org
Mon Jan 23 16:30:20 EST 2017
Terry J. Reedy added the comment:
The point I was trying to get at above is that simply printing a prompt and making the use enter the entire line should work on every console, while anything fancier may not be so reliable. Thinking more, I realize that my patch outline is incomplete. After 'line = input(prompt + indent)', line will not include the indent. A printed indent will have to be added to the input received from the user. (In IDLE's Shell and editors, the indents that IDLE insert()s into a text widget are indistinguishable from those types by a user and *are* included in the user input that IDLE reads.) An associated issue is that cross-platform automated tests would be difficult to impossible.
More experiment reveals the fatal problem: in REPL mode, python reads stdin and writes to stdout and stderr. In the Windows console, and I am sure others, printed output cannot be deleted. In particular, printed input spaces, such as the one at the end of '>>> ' cannot be deleted. So dedenting, as in the following example, would not be possible. One cannot input() a negative string.
if possible:
print('I like it')
write_patch()
test()
else:
print('too bad')
reject_idea()
So unless I am wrong, the idea must be rejected.
----------
stage: -> needs patch
versions: +Python 3.7
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29339>
_______________________________________
More information about the Python-bugs-list
mailing list