From de3bac1cc80cf55f004bc784203928060689a773 Mon Sep 17 00:00:00 2001 From: Inada Naoki Date: Wed, 10 Apr 2019 20:51:09 +0900 Subject: [PATCH 1/2] better __init__.py explanation in tutorial --- Doc/tutorial/modules.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/tutorial/modules.rst b/Doc/tutorial/modules.rst index accc30649f24eff..077fd94846b6722 100644 --- a/Doc/tutorial/modules.rst +++ b/Doc/tutorial/modules.rst @@ -425,9 +425,9 @@ your package (expressed in terms of a hierarchical filesystem): 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 the directories -as containing packages; this is done to prevent directories with a common name, -such as ``string``, from unintentionally hiding valid modules that occur later +The :file:`__init__.py` files are required to make Python treat directories +containing the file as packages. This prevents directories with a common name, +such as ``string``, unintentionally hide 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 set the ``__all__`` variable, described later. From 323907bc3dd90912514a5bcebde10a709a2efd31 Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Thu, 11 Apr 2019 14:24:13 +0900 Subject: [PATCH 2/2] Update Doc/tutorial/modules.rst Co-Authored-By: methane --- Doc/tutorial/modules.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/tutorial/modules.rst b/Doc/tutorial/modules.rst index 077fd94846b6722..fd594fd97af4d46 100644 --- a/Doc/tutorial/modules.rst +++ b/Doc/tutorial/modules.rst @@ -427,7 +427,7 @@ When importing the package, Python searches through the directories on The :file:`__init__.py` files are required to make Python treat directories containing the file as packages. This prevents directories with a common name, -such as ``string``, unintentionally hide valid modules that occur later +such as ``string``, 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 set the ``__all__`` variable, described later.