Issue 33960: IDLE REPL: Strange indentation

Issue33960

Created on 2018-06-25 20:40 by mdk, last changed 2022-04-11 14:59 by admin.

Files
File name Uploaded Description Edit
2018-06-25-223359_1920x1080_scrot.png mdk, 2018-06-25 20:40
Messages (3)
msg320440 - (view) Author: Julien Palard (mdk) * (Python committer) Date: 2018-06-25 20:40
Using IDLE REPL, I found confusing the absence of a "secondary prompt" while typing multiline statements, see attached screenshot where the "correctly aligned" code raises a SyntaxError while a strangely unaligned code is given correctly to the interpreter.
msg320448 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-06-25 22:45
Python's secondary prompt in interactive mode is an artifact of the fact the command line consoles work with physical lines while python works with statements that quite possibly comprises multiple lines.

As mentioned in the its doc, IDLE works with statements.  You edit and enter complete statements, not a line at a time. The history mechanism retrieves complete statements, not a line at a time.  The side effect is what you encountered.  '>>> ' is not an indent.  '    ' is.

While working with statements instead of lines is one of Shell's best features, the indentation awkwardness is one of its worst.  I intend to open an issue about separating the prompt from statement entry to remove the latter.  I will add you as nosy so you can give an opinion, I hope in support ;-).
msg320472 - (view) Author: Julien Palard (mdk) * (Python committer) Date: 2018-06-26 06:55
Thanks Terry, it perfectly make sense.

> I intend to open an issue about separating the prompt from statement entry to remove the latter.

Do you mean, by putting the ">>>" in a separated "physical" / "fixed-width" column left to the statements? It would solve the issue, and I don't know if there's other ways to do so.

Oh there's another: Not using a ">>>" prompt at all, but visually separating inputs and outputs.

I'm realizing Jupyter notebook is doing both: Using a fixed-width column with the prompts, left to the statements AND visually separating inputs and outputs. Not sure we have to do both, what do you think?

I tried to craft something with gimp out of my previous screenshot but it came out really ugly, I'm definitly not a UI designer :(
History
Date User Action Args
2022-04-11 14:59:02adminsetgithub: 78141
2018-12-12 02:36:59terry.reedysetversions: + Python 3.7, Python 3.8, - Python 3.6
2018-06-26 06:55:02mdksetstatus: closed -> open
resolution: not a bug ->
messages: + msg320472

stage: resolved ->

2018-06-25 22:45:31terry.reedysetstatus: open -> closed
resolution: not a bug
messages: + msg320448

stage: resolved

2018-06-25 20:40:17mdkcreate