Re: opposite of import

2006-08-03 Thread Simon Brunning
On 8/3/06, John Salerno <[EMAIL PROTECTED]> wrote: > According to Python in a Nutshell, references are stored in the > dictionary sys.modules, but I'm not sure if it matters that it's not > __modules__ instead (unless that also exists). Right you are - it's sys.modules, not sys.__modules__. -- C

Re: opposite of import

2006-08-03 Thread John Salerno
Simon Brunning wrote: > but for the fact that Python > stashes a reference to the module in (IIRC) sys.__modules__. And you > mess with *that* at your peril. ;-) According to Python in a Nutshell, references are stored in the dictionary sys.modules, but I'm not sure if it matters that it's not

Re: opposite of import

2006-08-03 Thread Duncan Booth
Gerhard Fiedler wrote: > On 2006-08-03 09:26:54, Simon Brunning wrote: > >>> import amodule >>> amodule.afunction() # Works fine >>> >>> del amodule >>> amodule.afunction() # Will die now >> >> Note that this doesn't get rid of a module entirely. Python will >> still holds on to the module, and

Re: opposite of import

2006-08-03 Thread Simon Brunning
On 8/3/06, Gerhard Fiedler <[EMAIL PROTECTED]> wrote: > Is that guaranteed, or is that just until the garbage collector has removed > the module (at some arbitrary point)? I *think* it's guaranteed. It's not a matter for the garbage collector. GC only exists to remove cyclic references. Ordinary

Re: opposite of import

2006-08-03 Thread Gerhard Fiedler
On 2006-08-03 09:26:54, Simon Brunning wrote: >> import amodule >> amodule.afunction() # Works fine >> >> del amodule >> amodule.afunction() # Will die now > > Note that this doesn't get rid of a module entirely. Python will still > holds on to the module, and if you just import it again at this

Re: opposite of import

2006-08-03 Thread Simon Brunning
On 8/3/06, Simon Brunning <[EMAIL PROTECTED]> wrote: > If you want to remove the module from a namespace into which you > imported it, you can do that with del: > > import amodule > amodule.afunction() # Works fine > > del amodule > amodule.afunction() # Will die now Note that this doesn't get rid

Re: opposite of import

2006-08-03 Thread Claudio Grondi
[EMAIL PROTECTED] wrote: > Hi > I am new to python. I wanted to know if there is an opposite of "import" > If you mean 'import' adds something, so you ask how to get rid of something? Here you are: Look at the 'del' statement if it is what you ar

Re: opposite of import

2006-08-03 Thread Simon Brunning
On 3 Aug 2006 04:50:35 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi > I am new to python. I wanted to know if there is an opposite of "import" Err, depends upon what you mean by opposite. If you want to remove the module from a namespace into which you import

Re: opposite of import

2006-08-03 Thread Lawrence Oluyede
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I am new to python. I wanted to know if there is an opposite of "import" What do you mean? What are you trying to accomplish? -- Lawrence - http://www.oluyede.org/blog "Nothing is more dangerous than an idea if it's

opposite of import

2006-08-03 Thread [EMAIL PROTECTED]
Hi I am new to python. I wanted to know if there is an opposite of "import" -- http://mail.python.org/mailman/listinfo/python-list