PEP 328, absolute/relative import (was: Re: Bizarre error from help())

Aahz aahz at
Thu Aug 11 04:56:52 CEST 2005

In article <dde6vi$na4$1 at rose.polar.local>,
Ben Finney  <bignose+hates-spam at> 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,

>>> sys.path
['', '/usr/local/lib/', '/usr/local/lib/python2.4', '/usr/local/lib/python2.4/plat-netbsd2', '/usr/local/lib/python2.4/lib-tk', '/usr/local/lib/python2.4/lib-dynload', '/usr/local/lib/python2.4/site-packages']
Aahz (aahz at           <*>

The way to build large Python applications is to componentize and
loosely-couple the hell out of everything.

More information about the Python-list mailing list