[Import-sig] Why add '' to sys.path if there's an __init__.py?
Fred L. Drake, Jr.
fdrake@beopen.com
Mon, 2 Oct 2000 20:26:59 -0400 (EDT)
Guido van Rossum writes:
> But the expectation is that you can import stuff from the current
> directory, and that's violated here. That's what I meant.
I think that expectation is broken if the current directory is
inside a package -- it was originally set up before we had packages.
> But if I chdir into somebody else's Lib/test directory, I expect that
> I can do this:
And I say the expectation is wrong. I can't think of anything but
Lib/test/ that works this way, and we've decided (in python-dev as I
recall) that package-relative imports should be discouraged. Instead,
cd to Lib/ and import test.autotest.
-Fred
--
Fred L. Drake, Jr. <fdrake at beopen.com>
BeOpen PythonLabs Team Member