If the __init__
module in a package is
empty, the package is little more than a collection of module files. In
this case, we don't generally make direct use of a package. We merely
mention it in an import statement: import
cards.poker
.
On other hand, if the __init__
module has
some definitions, we can import the package itself. Importing a package
just imports the __init__
module from the package
directory. In this case, we mention the package in an import statement:
import cards
.
Even if the __init__
module has some
definitions in it, we can always import a specific module from within
the package. Indeed, it is possible for the
__init__
module in a package is to do things like
adjust the search path prior to locating individual module files.