[Import-sig] Why add '' to sys.path if there's an __init__.py?
Guido van Rossum
Mon, 02 Oct 2000 20:27:13 -0500
> > Very clever. But what if the package's (grand*)parent is *not* on
> > sys.path? I say it's a user error and that's that.
> In that case, the problem (file importable by more than one module
> name) does not exist, and the ImportError is raised.
But the expectation is that you can import stuff from the current
directory, and that's violated here. That's what I meant.
> The solution I proposed doesn't mask the error in any way, it
> clarifies it by raising an ImportError. I think it improves the
> situation by producing less user confusion.
Usually, yes -- that's why I said "very clever".
But if I chdir into somebody else's Lib/test directory, I expect that
I can do this:
>>> import autotest
Your change would break this.
--Guido van Rossum (home page: http://www.python.org/~guido/)