[Python-Dev] Re: [Import-sig] Re: Proposal for a modified import mechanism.

James C. Ahlstrom jim at interet.com
Mon Nov 12 09:52:57 EST 2001


Gordon McMillan wrote:

> Currently, os.py in a package masks the real one from
> anywhere inside the package. This would extend that to

What???

When Python starts, it imports site.py which imports os.py.
So os.py gets loaded, and won't normally get re-loaded.
The os.py that gets loaded depends on sys.path.

So if os.py is in package1, it won't get loaded for "import os",
but it would get loaded for "import package1.os".  Are you saying
that "import package1.package2.os" will load package1/os.py?
I hope that "import os" will not load package1/os.py, will it?
Or am I totally confused.

Jim Ahlstrom




More information about the Python-list mailing list