Comment 6 for bug 1589186

Revision history for this message
John Vandenberg (jayvdb) wrote :

I agree pyflakes can special case submodule imports, as they cant be done another way.
Unless anyone objects, I will do the fix, which I suspect is a one-liner now.

> > and `scipy` on line 3 being an implicit import of `scipy`.
>
> I don't think that's an error. Python explicitly runs the top-level __init__.py and puts the module name in the namespace. For instance, this code works just fine
>
> import numpy.linalg
> numpy.array

While this is possible, it can also be a problem in complex code. Pywikibot had one such gnarly problem (https://phabricator.wikimedia.org/T113161) which I should extract out into a simple example of how implicit imports can be problematic.