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
This will do part of what you want:
>>> a=1
>>> b=1
>>> globals().clear()
>>> a
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'a' is not defined
That will not reset sys.modules, which is the only other thing I can
imagine being worried about.
The main reason IDLE has a restart is so that when you run a file after
editing, you can be sure the behavior you see is what you get when
running the file without IDLE, with a fresh interpreter. Another use of
refresh is when creating example interactive sessions for doctest or
book examples. Again, one wants to make sure that the example does not
depend on previous entries not included in the example. For ordinary
interactive exploration, refresh is seldom needed.
tjr