From the Python glossary:
It’s important to keep in mind that all packages are modules, but not all modules are packages. Or put another way, packages are just a special kind of module. Specifically, any module that contains a
__path__
attribute is considered a package.
Python files with a dash in the name, like my-file.py
, cannot be imported with a simple import
statement. Code-wise, import my-file
is the same as import my - file
which will raise an exception. Such files are better characterized as scripts whereas importable files are modules.