gh-113208: Mention namespace packages don't require __init__.py (#113209)

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
This commit is contained in:
Unique-Usman 2023-12-19 14:09:57 +05:30 committed by GitHub
parent 4658464e9c
commit d71fcdee0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -437,7 +437,8 @@ When importing the package, Python searches through the directories on
``sys.path`` looking for the package subdirectory. ``sys.path`` looking for the package subdirectory.
The :file:`__init__.py` files are required to make Python treat directories The :file:`__init__.py` files are required to make Python treat directories
containing the file as packages. This prevents directories with a common name, containing the file as packages (unless using a :term:`namespace package`, a
relatively advanced feature). This prevents directories with a common name,
such as ``string``, from unintentionally hiding valid modules that occur later such as ``string``, from unintentionally hiding valid modules that occur later
on the module search path. In the simplest case, :file:`__init__.py` can just be on the module search path. In the simplest case, :file:`__init__.py` can just be
an empty file, but it can also execute initialization code for the package or an empty file, but it can also execute initialization code for the package or