[Python-ideas] Have REPL print less by default

Terry Reedy tjreedy at udel.edu
Tue Apr 19 18:02:54 EDT 2016


On 4/19/2016 9:12 AM, Nick Coghlan wrote:

> The default REPL behaviour is appropriate for this "somewhat experienced
> Pythonista tinkering with code to see how it behaves" use case - keeping
> the results very close to what they would be if you typed the same line
> of code into a text file and ran it that way. It's not necessarily the
> best way to *learn* those equivalences, but that's also not what it's
> designed for.

The default REPL behavior should not throw away output.  In the Windows 
console, what is not displayed cannot be retrieved.  Reversible output 
editing is possible and appropriate in a GUI that can keep output 
separate from what is displayed.

> IPython's REPL is tailored for a different audience - their primary
> audience is research scientists, and they want to be able to better
> eyeball calculation results, rather than lower level Python instance
> representations. As a result, it's much cleverer than the default REPL,
> but it's also aiming to tap into people's intuitions about the shape of
> their data and the expected outcomes of the operations they're
> performing on it, rather than their ability to mentally run Python code
> specifically.
>
> A REPL designed specifically for folks learning Python, like the one in
> the Mu editor, or the direction IDLE seems to be going, would likely be
> better off choosing different default settings for sys displayhook and
> sys.excepthook,

There is a external Squeezer extension to IDLE that more or less does 
what this thread proposes and is also reversible.  Deleted blocks are 
replaced by something that can be clicked on to expand the text.  There 
is a proposal to incorporate Squeezer into IDLE.  I have not reviewed 
the proposal yet because it would not solve any of my problems.  I am 
more interested in way to put long output from help() into a separate 
text window instead of the shell.

> but those changes would be best selected based on direct
> observations of classrooms and workshops, and noting where folks get
> confused or intimidated by the default settings. For environments other
> than IDLE, they can also be iterated on at a much higher rate than we
> make CPython releases.

-- 
Terry Jan Reedy




More information about the Python-ideas mailing list