Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > is it possible to del an imported module?

Reply
Thread Tools

is it possible to del an imported module?

 
 
dw
Guest
Posts: n/a
 
      02-18-2004
my program has potentially hundreds of small py file that
each open an
mdichildframe (just like demo from wxPython). I
implemented it by
importing the file before use, but would like it be get
ridded off
from memory afterward.

--
dody wijaya

================================================== =========================================
Akses Internet Prabayar TELKOMNet-Prepaid,
nominal Rp.10.000- Rp.150.000.
Dapatkan di Plasa - Plasa TELKOM terdekat (khusus di Jawa Timur)
================================================== =========================================

 
Reply With Quote
 
 
 
 
Peter Hansen
Guest
Posts: n/a
 
      02-18-2004
dw wrote:
>
> my program has potentially hundreds of small py file that
> each open an
> mdichildframe (just like demo from wxPython). I
> implemented it by
> importing the file before use, but would like it be get
> ridded off
> from memory afterward.


Files are actually imported only *once*, and the resulting module
is cached in sys.modules for later use. If a second or third
"import" statement imports the same module, it really just creates
a new reference to the same module.

If I were you, I wouldn't worry about the overhead of any of this
unless you actually observe excessive memory consumption in your
program. (That is, if it doesn't actually cause trouble, just
ignore it.)

-Peter
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why do directly imported variables behave differently than thoseattached to imported module? Dun Peal Python 10 05-03-2011 10:11 PM
del an imported Class at EOF... why? Ryan Python 12 10-08-2009 08:20 PM
Is it possible to exclude an imported xslt library temporarily ? tuka XML 3 08-10-2007 10:12 AM
Remote Assistance CTRL+ALT+DEL =?Utf-8?B?U3Rldm8=?= MCSE 6 08-20-2005 01:47 PM
"Variable ... is not imported..." using an imported variable from a module Volker Nicolai Perl Misc 9 07-04-2005 08:34 AM



Advertisments