Why bother to limit the types imported from a python package?
Question: When using many IDEs that support autocompletion with Python, things like this
will show warnings, which I find annoying:

    
    
    from eventlet.green.httplib import BadStatusLine
    

When switching to:

    
    
    from eventlet.green.httplib import *
    

The warnings go away. What's the benefit to limiting imports to a specific set
of types you'll use? Is the parsing faster? Reduces collisions? What other
point is there? It seems the state of python IDEs and the nature of the typing
system makes it hard for many IDEs to fully get right when a type import works
and when it doesn't.


Answer: By typing `from foo import *`, you import _all_ the names defined in `foo`
into the global namespace. This is bad practice because you could have name
clashes both with other modules and with built-ins.

For example, consider a module `foo`

    
    
    #foo.py
    def open(something):
        pass
    

and a module `bar`:

    
    
    #bar.py
    def open(something_else):
        pass
    

Now, `from foo import *` hides the built-in function `open()` which means that
any calls to `open()` now refer to `foo.open()` rather than the built-in.
Worse, if you then have `from bar import *`, the function `open()` in `bar`
now hides both the built-in _and_ the function imported from `foo`.

In the example above, `from foo import open` is equally shadowing the built-in
function, but one glance at the code tells you why you can't open files for IO
anymore.

This is why you should import only specific names, ensuring that you _know_
what names are imported. Alternatively, you could use fully qualified names
(`import foo; foo.open()`, which is perfectly safe).

EDIT: Just as a note, this can be horribly compounded if the module you're
importing also uses `from x import *`. In this case, not only do you typically
import all the stuff in the module `foo`, but also all the stuff in the module
`x` into the global namespace. This can very quickly turn into an absolute
mess.

