.pyc files
Skip Montanaro
skip at pobox.com
Tue Jan 28 18:24:48 EST 2003
newt> As suggested, I want to compile from within IDE so that my .pyc
newt> file gets updated. Perhaps there is an alternative approach
newt> though. Is it possible to force an import to reproduce the .pyc
newt> file? e.g. if I have a file newt_i.py, which is imported by
newt> newt.py, then when I first run it newt_i.pyc get 'compiled' to
newt> newt_i.pyc. If I then change newt_i.py, and run newt.py, then it
newt> will still import the existing newt_i.pyc, not a .pyc version of
newt> the new file. Is this correct?
If the .pyc file is out-of-date wrt to the .py file, the source will get
byte-compiled and a new .pyc file written automatically.
newt> Would reload(newt_i) (within the relevent code) do the trick?
Yes.
Python just does the right thing. I've never encountered a situation where
it didn't. Don't worry about it until you need to and you'll die with one
less grey hair. ;-)
Skip
More information about the Python-list
mailing list