[Tutor] idle - namespaces (was idle)

Kirby Urner urnerk@qwest.net
Sun, 31 Mar 2002 15:49:32 -0800


At 12:16 AM 4/1/2002 +0100, alan.gauld@bt.com wrote:
>I may have missed the answer to this but here goes anyway...
>
> > away code. However I just noticed something, when I delete all the code
> > to write some more throw away code the variables and I think also other
> > things do not get deleted. How do I delete them?
>
>With great difficulty.
>
>When you import names from a module they get stored
>in a dictionary. When you reload a module it simply
>adds the names - which is why reload doesn't work
>for the "from f import x" form.
>
>The only reliable way to do this is to exit and restart
>(Cameron another reason I use the OS command line...)
>

But note that you can do both, i.e.

import xxx
from xxx import a,b,c

Then if you change the code in xxx, you can have
a routine in your shell to reload(xxx) and reimport
a,b,c.  The code changes will now be reflected in
your current namespace, without exiting and re-entering.

Kirby