<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 18 April 2016 at 15:32, Franklin? Lee <span dir="ltr"><<a href="mailto:leewangzhong+python@gmail.com" target="_blank">leewangzhong+python@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><p dir="ltr">On Apr 17, 2016 11:24 PM, "Ben Finney" <<a href="mailto:ben%2Bpython@benfinney.id.au" target="_blank">ben+python@benfinney.id.au</a>> wrote:<br>
><br>
> Surem, that would be a good place for it. I think that's much more<br>
> feasible than changing the behaviour of ‘repr’ for this purpose.</p>
</span><p dir="ltr">Huh? I never meant for any change to happen to `repr`. The desired behavior is, "Set default: Each command entered into the REPL should have limited output (without loss of capability for a newbie)." The proposal is to have the REPL determine when it's going to output too much.</p></blockquote><div>A few tips for folks that want to play with this:<br><br></div><div>- setting sys.displayhook controls how evaluated objects are displayed in the default REPL<br></div><div>- setting sys.excepthook does the same for exceptions<br></div><div>- the PYTHONSTARTUP env var runs the given file when the default REPL starts<br></div><div><br></div></div>So folks are already free to change their REPL to work however they want it to: set sys.displayhook and sys.excepthook from a PYTHONSTARTUP file<br><br></div><div class="gmail_extra">Changing the *default* REPL behaviour is a very different question, and forks off in a couple of different directions:<br><br></div><div class="gmail_extra">- improved defaults for teaching novices? Perhaps the default REPL isn't the best environment for that<br></div><div class="gmail_extra">- easier debugging at the REPL? Perhaps pprint should gain an "install_displayhook()" option that overwrites sys.displayhook and optionally allows enabling of an output pager<br></div><br><div class="gmail_extra">Since the more the REPL does, the more opportunities there are for it to break when debugging, having the output hooks be as simple as possible is quite desirable. However, making it easier to request something more sophisticated via the pprint module seems like a plausible approach to me.<br clear="all"></div><div class="gmail_extra"><br></div><div class="gmail_extra">Cheers,<br></div><div class="gmail_extra">Nick.<br><br></div><div class="gmail_extra">-- <br><div class="gmail_signature">Nick Coghlan | <a href="mailto:ncoghlan@gmail.com" target="_blank">ncoghlan@gmail.com</a> | Brisbane, Australia</div>
</div></div>