PEP 328, absolute/relative import

Ben Finney bignose+hates-spam at benfinney.id.au
Wed Aug 10 23:48:19 EDT 2005


Aahz <aahz at pythoncraft.com> wrote:
> Ben Finney  <bignose+hates-spam at benfinney.id.au> wrote:
> >So, under PEP 328 rules, the original poster's current-directory
> >module could only be imported (a) if the current directory was in
> >sys.path, or (b) if the code specified a relative import. The
> >accidental shadowing of the stdlib module could not happen.
> 
> Normally the current directory *is* on sys.path, and the first
> thing, too:

Ah. I'd forgotten that, my bad.

So, modules in the current directory will continue to be imported as
before, because they *are* absolute imports by PEP328 definitions.

-- 
 \        "If it ain't bust don't fix it is a very sound principle and |
  `\      remains so despite the fact that I have slavishly ignored it |
_o__)                                  all my life."  -- Douglas Adams |
Ben Finney <http://www.benfinney.id.au/>



More information about the Python-list mailing list