[Idle-dev] IDLE shell: Moving prompts to a side-bar

Guido van Rossum guido at python.org
Sat Nov 2 00:58:27 EDT 2019


On Fri, Nov 1, 2019 at 9:24 PM Terry Reedy <tjreedy at udel.edu> wrote:

> On 11/1/2019 6:45 PM, Guido van Rossum wrote:
> > If I’d known that was possible I’d have done that 2 years ago. So +1.
>
> Did you mean 20 years ago (1999), when (AFAIK) you submitted the first
> patches?
>

Yes. Stupid phone "keyboard".


> In any case, I appreciate the quick positive response from you and
> André.  I posted the idea for this over 5 years ago and a majority of
> people, including the two commenting on the current issue,
> https://bugs.python.org/issue37903
> have not been as enthusiastic (as in don't seem to have gotten why it is
> a great idea).
>

It is obviously a great idea if you ever want to copy a multi-line
statement from the IDLE shell to a module, since the prompt doesn't get in
the way (and you will be able to use spaces instead of tabs for indentation
-- apart from a few oddballs, everyone uses four spaces).


>  > On Fri, Nov 1, 2019 at 7:37 PM Tal Einat <taleinat at gmail.com> wrote:
>
>  >> I'm attaching a screenshot to make it easy to get a feel for what is
> proposed.
>
> I should have mocked this years ago in my post to
> https://bugs.python.org/issue7676
>
> As it is, the screenshot does not yet show 8-column tab indents replaced
> with 4-space indents. (An immediate follow-on patch.) The following
> better shows this part of the goal.
>
> >>>|print("Hello, world")
>    |Hello, world!
> >>>|if True:
> ...|    if "Let's get rid of 8-space tabs!":
> ...|        print("This indentation is just right.")
> ...|
>    |This indentation is just right.
>
> where the strength and visibility of the vertical line depends on the OS
> widgets and the background colors of the sidebar and text box.
>

What I said.


> I have more recently tried to (somewhat conservatively) 'reimagine' how
> the IDLE's shell should operate, following these principles:
> 1. User code should be executed properly.  AFAIK, done.
> 2. User code should be formatted properly (as in the editor).  This is
> not  true now but will be with this change and the follow-up indent change.
> 3. Interaction should be made as easy as possible, even if it means
> looking or operating a bit differently from the standard REPL.  IDLE
> already does this somewhat, and posted ideas for follow-up changes to
> https://bugs.python.org/issue37892
>

Probably the most popular alternate REPL is IPython (whether standalone or
in Jupyter Notebook) which is way different from the standard REPL anyway.
So you're in good company wanting a different REPL in IDLE.

In issue 37903, RH appears to be requiring support for doctests.
(Interestingly, in issue 7676 he wishes the IDLE shell wouldn't use tabs,
which you're going to support.) I'm a little confused by his comments about
doctests. IMO copying from a "doctest" in the docs to the shell is not
affected -- the problem there is purely that you have to work hard to avoid
also copying the ">>>" and (especially) "..." prompts into the shell. That
seems to me to be the main thing people would do with doctests, and it's
unaffected. It's true that recreating a doctest from an IDLE shell session
is a little harder -- but a nice fallback is to use the python binary
itself, which has the exact behavior you'd want. So I don't see this as a
reason not to backport. (This also seems pretty niche. I don't know if he
can back up his claim that doctests have become more popular.)

I also don't see a reason to start supporting sys.ps1/ps2 -- I copied that
feature rather mindlessly from the UNIX shell 30 years ago, and probably
wouldn't have done it the same way today. (The only useful thing to do here
might be to set sys.ps2="", to make copying from a shell window a little
less painful. But your solution solves that much more elegantly.)

-- 
--Guido van Rossum (python.org/~guido)
*Pronouns: he/him **(why is my pronoun here?)*
<http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/idle-dev/attachments/20191101/419a8c08/attachment.html>


More information about the IDLE-dev mailing list