Re: Restart the interactive python shell like in IDLE

Discussion in 'Python' started by Chris Rebert, Jun 11, 2009.

  1. Chris Rebert

    Chris Rebert Guest

    On Wed, Jun 10, 2009 at 12:01 PM, Matt Burson<> 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
     
    Chris Rebert, Jun 11, 2009
    #1
    1. Advertising

  2. On Thursday, June 11, 2009 1:48:42 AM UTC+2, Chris Rebert wrote:
    > On Wed, Jun 10, 2009 at 12:01 PM, Matt Burson<> 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


    You might be launching python from something else other than a shell and it might be harder to re-launch it from there
     
    Ricardo Abreu, Sep 30, 2013
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ashot
    Replies:
    22
    Views:
    4,210
    Fernando Perez
    Feb 8, 2005
  2. markscottwright

    How to I restart an interactive session?

    markscottwright, Mar 18, 2005, in forum: Python
    Replies:
    4
    Views:
    353
    Diez B. Roggisch
    Mar 19, 2005
  3. Terry Reedy
    Replies:
    0
    Views:
    643
    Terry Reedy
    Jun 11, 2009
  4. lzlu123
    Replies:
    4
    Views:
    344
    lzlu123
    Aug 22, 2011
  5. Josef Moellers

    Restart Perl Application upon KDE Restart

    Josef Moellers, Jul 18, 2013, in forum: Perl Misc
    Replies:
    18
    Views:
    284
    Adam H. Kerman
    Jul 26, 2013
Loading...

Share This Page