'reload M' doesn't update 'from M inport *'

Frederic Rentsch anthra.norell at bluewin.ch
Fri Jul 9 09:02:25 EDT 2010


I develop in an IDLE window.

Module M says 'from service import *'.
Next I correct a mistake in function 'service.f'.
Now 'service.f' works fine.

I do 'reload (service); reload (M)'.
The function 'M.f' still misbehaves.

'print inspect.getsource (service.f)' and
'print inspect.getsource (M.f)' shows the same 
corrected code. 

'print service.f' and 'print M.f' show different ids.

So I do 'del M; reload (M)'. Nothing changes.

I delete M again and run gc.collect () to really 
clean house. I reload M again and still nothing changes.
The id of the reloaded function 'M.f' is still the 
same as it was before the purge and so M.f still isn't 
fixed.  

I know I have more radical options, such as starting 
a new IDLE window. That would save me time, but 
I'd like to take the opportunity to understand what
is happening. Surely someone out there knows.

Frederic
 







More information about the Python-list mailing list