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

Jeremy Hylton jeremy at zope.com
Mon Nov 12 11:33:19 EST 2001


>>>>> "PR" == Prabhu Ramachandran <prabhu at aero.iitm.ernet.in> writes:

  PR> Ummm doing an 'import os' will import the package1/os.py and
  PR> *not* the standard one.  This will happen even though os.py was
  PR> imported earlier by site.py.  This is what Gordon was objecting
  PR> to in the first place and why he proposes using rimport,
  PR> rrimport etc. to make things more explicit.

Of course, you can use the existing mechanism to do this: 'from
package1 import os'.  The use of an explicit name seems like the
clearest route when you have a package-local module that shadows a
top-level module -- no need to understand details of relative imports,
no question about what is intended by the code.

I haven't followed this thread closely.  Is there some reason that
explicit names in imports is not sufficient?

Jeremy





More information about the Python-list mailing list