From: Unique-Usman <86585626+Unique-Usman@users.noreply.github.com> Date: Tue, 19 Dec 2023 08:39:57 +0000 (+0530) Subject: gh-113208: Mention namespace packages don't require __init__.py (#113209) X-Git-Tag: v3.13.0a3~330 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d71fcdee0f1e4daa35d47bbef103f30259037ddb;p=thirdparty%2FPython%2Fcpython.git gh-113208: Mention namespace packages don't require __init__.py (#113209) Co-authored-by: C.A.M. Gerlach --- diff --git a/Doc/tutorial/modules.rst b/Doc/tutorial/modules.rst index bf9e8e0b7b80..0316239e776a 100644 --- a/Doc/tutorial/modules.rst +++ b/Doc/tutorial/modules.rst @@ -437,7 +437,8 @@ When importing the package, Python searches through the directories on ``sys.path`` looking for the package subdirectory. 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 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