Restart the interactive python shell like in IDLE

Chris Rebert clp2 at rebertia.com
Wed Jun 10 19:48:42 EDT 2009


On Wed, Jun 10, 2009 at 12:01 PM, Matt Burson<msburson at gmail.com> wrote:
> Is there a way to reproduce the behavior of IDLE's restart shell ability by
> using a function? I thought there would be since you can exit python by
> executing the simple quit() function I thought there would be an equally
> simple function name something like restart(). I'd prefer something like
> this as opposed to having to exit the shell and then start it up again to
> refresh it.

I believe IDLE itself implements the "restart" capability by killing
and re-launching its Python interpreter subprocess, so it's not like
it's using some hidden capability of Python to accomplish this.
Is doing Ctrl+D, up-arrow, Enter really that hard? It's even fewer
keystrokes than "restart()"...

Cheers,
Chris
-- 
http://blog.rebertia.com



More information about the Python-list mailing list