[Python-Dev] Importing .pyc in -O mode and vice versa

Greg Ewing greg.ewing at canterbury.ac.nz
Wed Nov 8 02:38:18 CET 2006

Martin v. Löwis wrote:

> Currently, you can put a file on disk and import it
> immediately; that will stop working.

One thing I should add is that if you try to import
a module that wasn't there before, the interpreter will
notice this and has the opportunity to update its idea
of what's on the disk.

Likewise, if you delete a module, the interpreter will
notice when it tries to open a file that no longer exists.

The only change would be if you added a module that
shadowed something formerly visible further along
sys.path -- in between starting the program and
attempting to import it for the first time.

So I don't think there would be any visible change as
far as most people could tell.


More information about the Python-Dev mailing list