Skip to content

Commit ca5a523

Browse files
miss-islingtonUnique-UsmanCAM-Gerlach
authored
[3.12] gh-113208: Mention namespace packages don't require __init__.py (GH-113209) (#113276)
Co-authored-by: Unique-Usman <[email protected]> Co-authored-by: C.A.M. Gerlach <[email protected]>
1 parent 1c2fcd8 commit ca5a523

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Doc/tutorial/modules.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,8 @@ When importing the package, Python searches through the directories on
437437
``sys.path`` looking for the package subdirectory.
438438

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

0 commit comments

Comments
 (0)