[Python-ideas] Have REPL print less by default

Terry Reedy tjreedy at udel.edu
Wed Apr 20 15:24:42 EDT 2016

On 4/20/2016 2:15 PM, Random832 wrote:
> On Wed, Apr 20, 2016, at 13:57, Koos Zevenhoven wrote:
>> On Wed, Apr 20, 2016 at 8:46 PM, Terry Reedy <tjreedy at udel.edu> wrote:
>>> On 4/20/2016 6:39 AM, Koos Zevenhoven wrote:
>>>> def fun():
>>>>     fun()
>>>> fun()
>>>> Does that.
>>> The above produces pairs of lines, so I do not understand your point.
>> Strange. for me it produces a repeating single line. Tried both on
>> 2.7.6. and 3.5.1. Probably not worth discussing, though.
> It produces single lines in the interactive interpreter, pairs in a
> file.

Aha.  In IDLE's Shell, which generally simulates the interactive 
interpreter quite well, pairs are printed because interactive user input 
is exec'ed in a process running Python in normal batch mode.  I expect 
any GUI shell to act similarly.

I consider interactive interpreter omission of the line at fault to be a 
design buglet.  For a single line of input, it is not much of a problem 
to look back up.  But if one pastes a 20-line statement, finding line 
13, for instance, is not so quick.  And on Windows, a 1000 line 
traceback may erase the input so there is nothing to look at.

Terry Jan Reedy

More information about the Python-ideas mailing list