Does Python cache the startup module?

Baz Walter bazwal at googlemail.com
Mon Jan 7 14:21:28 EST 2008


Guilherme Polo <ggpolo <at> gmail.com> writes:
> Uhm.. this didn't make much sense. If you say the module is cached,
> then supposing you did a minor edit, and then supposing because it is
> cached your application wouldn't detect the change, then I don't see
> the connection with memory leak.
> 
> Bring some concrete proof.

Thanks for your reply.

It's hard to supply an example for this, since it is local to the machine I am 
using. The startup module would look something like this:

#!/usr/local/bin/python

if __name__ == '__main__':
    
    import sys
    from qt import QApplication, QWidget

    application = QApplication(sys.argv)
    mainwindow = QWidget()
    application.setMainWidget(mainwindow)
    mainwindow.show()
    sys.exit(application.exec_loop())

If I change the name 'mainwindow' to 'mainwidget', the widget it refers to does 
not get destroyed; when I change it back again, it does get destroyed. 
Otherwise, the program runs completely normally.





More information about the Python-list mailing list