- Phase: 7. Modules, Stdlib & Testing
- Duration: 1.5 hours
- Understand packages as directories of modules
- Use
__init__.pyto control package initialization - Navigate subpackages with absolute and relative imports
- Control exports with
__all__ - Understand namespace packages (PEP 420)
- Packages as directories with
__init__.py - Purpose of
__init__.py(can be empty or contain initialization code) - Subpackages and nested package structures
- Absolute imports (
from package import module) - Relative imports (
from . import,from .. import) __all__attribute to controlfrom package import *- Namespace packages (PEP 420) — implicit packages without
__init__.py
Module 063: Modules and Imports
Module 065: Virtual Environments and pip