[IPython-user] re set doesn't
Robert Kern
robert.kern@gmail....
Wed Dec 9 21:28:44 CST 2009
On 2009-12-09 20:14 PM, Dr. Phillip M. Feldman wrote:
>
> Robert Kern-2 wrote:
>>
>> On 2009-12-07 18:06 PM, Dr. Phillip M. Feldman wrote:
>>
>> 1. Imports of extension modules simply can't be undone in Python.
>
> This is obviously not the case. When I kill Python and reload it, all
> module imports are gone (and all figure windows are closed). Voila!
That's not what people usually mean when they say "reset the interpreter" or
"unloading a module".
> The
> question is this: Is there a practical way to do this via a command? I know
> that in Linux and Unix, a process can relaunch the executable with which it
> is associated, which wipes out all state and starts things over from the
> beginning.
That's not really a good description of what's going on. "Wiping out all state"
usually implies that some non-state stuff, like the interpreter itself, remains.
Similarly, "unloading a module" is usually taken to mean that the process
continues to exist.
> So, in Linux and Unix implementations of Python, it should be
> possible to do this. I'm not sure about Windows.
It's the same on Unix and Windows. You want something in the os.exec*() family
of functions.
http://docs.python.org/library/os#os.execl
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the IPython-user
mailing list