Reputation: 25
I know what it does, how it works and all, but why might we ever want to use it?
I mean if a programmer wanted to import the objects from a module, he could then just use the simple
import <module>
syntax. It's not like the all variable is hiding anything, right?
Upvotes: 0
Views: 161
Reputation: 1124000
from <module> import *
and help(<module>)
both use the __all__
attribute of a module to limit what is imported or documented.
Note that from <module> import *
is generally considered bad practice unless you are building a central API for a package with the implementation dispersed over various contained modules.
Upvotes: 2