pyc file [Newbie Question]

Duncan Booth duncan.booth at invalid.invalid
Tue Apr 3 04:01:15 EDT 2007


Steven D'Aprano <steve at REMOVEME.cybersource.com.au> wrote:

> On Mon, 02 Apr 2007 23:44:41 -0700, Jim Aikin wrote:
> 
>> Working through the tutorial, I created a file called fibo.py in my
>> text editor, and imported it into Idle. It worked as expected. I then
>> edited the file and resaved it. I used del fibo, followed by import
>> fibo. 
> 
> That probably won't cause a full re-import. del fibo will only delete
> the reference called "fibo". The underlying module object will still
> exist until it is garbage-collected. It will only be garbage-collected
> if it isn't being used. Chances are, the module *is* being used
> somewhere, so when you call "import fibo" the import machinery simply
> gives you a new reference to the old module object.
> 

The underlying module won't be garbage collected. If nowhere else, it will 
still be accessible as sys.modules['fibo']



More information about the Python-list mailing list