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 <rep...@bugs.python.org>
<http://bugs.python.org/issue29339>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to