This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients hugonobrega, terry.reedy
Date 2021-03-04.21:15:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1614892530.27.0.869612582146.issue43402@roundup.psfhosted.org>
In-reply-to
Content
I don't know how many core devs would agree that inserting '\n' would be preferable.  They might say that users who want clean interaction should not use the 'end' parameter the way you did in interactive mode.

IDLE is more aimed at beginners and can be more protective and/or opinionated.  In any case, I agree with whoever wrote or edited this part of IDLE before me as to what IDLE should do.

There are also technical  issues.  Interactive python uses the common features of the various OS text and line-oriented terminal/consoles.  These do not know and do not care that they are displaying python input and output.  They display chars received from the executing program and have no way of knowing that the last n chars match python's sys.ps1 or sys.ps2.  The prompts comes from python executing "input(prompt)" after user code finishes.  To conditionally insert a newline, python would have to keep track of whether or not the last char sent by user code was a newline or not.

IDLE, on the other hand, is customized to run python code.  It *emulates* interactive mode with exec() calls.  IDLE, not python, displays prompts however programmed to do so.  It is trivial to check whether the last char inserted in the text widget is '\n' or not.

Side note: you only need '-i' for interactive mode when you also run a file because 'python -i' by itself is the same as 'python'.

'python -i somefile' is different from 'python somefile' because in the latter case, python exits after executing somefile, whereas in the former case, python executes 'input(sys.ps1)' and possibly 'input(sys.ps2)' until told to quit.  'Run module' in an IDLE editor emulates 'python -i <filename>'.
History
Date User Action Args
2021-03-04 21:15:30terry.reedysetrecipients: + terry.reedy, hugonobrega
2021-03-04 21:15:30terry.reedysetmessageid: <1614892530.27.0.869612582146.issue43402@roundup.psfhosted.org>
2021-03-04 21:15:30terry.reedylinkissue43402 messages
2021-03-04 21:15:30terry.reedycreate