[Python-Dev] PEP 328: path (original) (raw)

Aahz aahz at pythoncraft.com
Sun Apr 4 15:57:56 EDT 2004


On Sun, Apr 04, 2004, Guido van Rossum wrote:

Aahz:

I just realized that the new relative import semantics are likely to interact oddly with uses of _path_. I therefore suggest that the following text be added to PEP 328, although I'm perfectly happy to adopt some other course: Between the addition of as in Python 2.0 and the new syntax & semantics for import, there is no longer a need for _path_, and it is now officially deprecated. In Python 2.4 and 2.5, changing _path_ raises PendingDeprecationWarning. In Python 2.6, _path_ becomes a read-only attribute. In the presence of absoluteimport or with a relative import, _path_ is ignored. Uh? Maybe you should have some coffee and then try again.

Don't drink coffee, remember? ;-)

path has nothing to do with relative import. When I say "import foo.bar" then bar is searched for in foo.path. path defines which directories comprise the package contents, nothing more or less.

Yeah, I know; I think that as combined with relative imports can obviate most uses for __path__, but I'm now dealing with a family emergency, so I'm going to just drop it.

Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/

"usenet imitates usenet" --Darkhawk



More information about the Python-Dev mailing list