Does Python cache the startup module?

Baz Walter bazwal at googlemail.com
Mon Jan 7 13:30:04 EST 2008


Hello

I remember reading somewhere (probably this list) that python may cache the 
module that starts a program (e.g. 'main.py'). I'm asking because I have found 
that this can sometimes cause problems when making small edits to the module. 
For instance, in my current module I changed the name of the main gui widget. 
When I ran the program, the program started to leak memory like a sieve. I then 
changed the name back again, and the problem went away. This looks very much 
like some sort of weird caching behaviour to me.

I've tried deleting the .pyc file and even re-booting, but I can't make the 
problem go away!

Can anyone confirm that this caching happens? And if so, is it documented 
anywhere?

TIA





More information about the Python-list mailing list