[Python-checkins] better __init__.py explanation in tutorial (#12763)
Inada Naoki
webhook-mailer at python.org
Thu Apr 11 02:10:38 EDT 2019
https://github.com/python/cpython/commit/5410d3d283b11e2375f0c1f79728a230edd12bd0
commit: 5410d3d283b11e2375f0c1f79728a230edd12bd0
branch: master
author: Inada Naoki <songofacandy at gmail.com>
committer: GitHub <noreply at github.com>
date: 2019-04-11T15:10:35+09:00
summary:
better __init__.py explanation in tutorial (#12763)
* better __init__.py explanation in tutorial
* Update Doc/tutorial/modules.rst
Co-Authored-By: methane <songofacandy at gmail.com>
files:
M Doc/tutorial/modules.rst
diff --git a/Doc/tutorial/modules.rst b/Doc/tutorial/modules.rst
index accc30649f24..fd594fd97af4 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 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.
More information about the Python-checkins
mailing list