[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

Re: Does Python cache the startup module?

Fredrik Lundh

1/7/2008 7:30:00 PM

Baz Walter wrote:

> 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:

would look, or does look? if it doesn't look like this, what else does
it contain?

> #!/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.

I don't see any code in there that destroys the widget, and I also don't
see any code in there that creates more than one instance of the main
widget.

what do you do to run the code, and how to you measure leakage?

is the name "mainwidget" used for some other purpose in your application?

</F>