[Python-ideas] Move more parts of interpreter core to stdlib

Terry Reedy tjreedy at udel.edu
Tue Aug 27 22:06:48 CEST 2013


On 8/27/2013 4:27 AM, Draic Kin wrote:
> On Tue, Aug 27, 2013 at 10:11 AM, Antoine Pitrou
> > Draic Kin <drekin at gmail.com
> > > Antoine wrote:
> > > > The one thing that may be considered is whether there is a point in
> > > > having two versions of the interactive prompt: the default one
> > > > in C, and a re-usable Python one in code.py.

Idlelib.PyShell subclasses code.InteractiveInterpreter as 
ModifiedInterpreter. It probably add the same behavior as 
code.InteractiveConsole(InteractiveInterpreter), except for a gui rather 
than text environment.

> > > There are also subtle differences between the two. E.g. whether to
> > > write the prompt to stdout or stderr, how to behave when attributes
> > > sys.ps1, sys.ps2 are missing, and of course whether to get input from
> > > sys.stdin or the standard STDIN.

The Idle shell window subclasses the Idle editor window, which is based 
on tk text widgets. The shell puts prompts to and gets code input from 
its text widget. By default, it uses '>>> ' and '' as prompts (and 
indents with \t = 8 spaces, which should be changed somehow).

> > Yes... But I'm not sure those differences were intended in the first
> > place. IMO it would make sense to smooth them out.  (there's a lot
> > of historical baggage that could explain the discrepancies)

Guido did the first 13 commits; ask him ;-).

> I definitely agree that they should be smoothed out, I was just pointing
> them out.

Nice idea, as long as it does not break current user applications ;-).

-- 
Terry Jan Reedy



More information about the Python-ideas mailing list