is it possible to del an imported module?

Discussion in 'Python' started by dw, Feb 18, 2004.

  1. dw

    dw Guest

    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)
    ===========================================================================================
     
    dw, Feb 18, 2004
    #1
    1. Advertisements

  2. dw

    Peter Hansen Guest

    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
     
    Peter Hansen, Feb 18, 2004
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.