diff --git a/Doc/tutorial/modules.rst b/Doc/tutorial/modules.rst --- a/Doc/tutorial/modules.rst +++ b/Doc/tutorial/modules.rst @@ -156,22 +156,21 @@ .. index:: triple: module; search; path When a module named :mod:`spam` is imported, the interpreter searches for a file -named :file:`spam.py` in the current directory, and then in the list of -directories specified by the environment variable :envvar:`PYTHONPATH`. This -has the same syntax as the shell variable :envvar:`PATH`, that is, a list of -directory names. When :envvar:`PYTHONPATH` is not set, or when the file is not -found there, the search continues in an installation-dependent default path; on -Unix, this is usually :file:`.:/usr/local/lib/python`. +named :file:`spam.py` in a list of directories given by the variable +:data:`sys.path`. :data:`sys.path` is initialized from these locations: -Actually, modules are searched in the list of directories given by the variable -``sys.path`` which is initialized from the directory containing the input script -(or the current directory), :envvar:`PYTHONPATH` and the installation- dependent -default. This allows Python programs that know what they're doing to modify or -replace the module search path. Note that because the directory containing the -script being run is on the search path, it is important that the script not have -the same name as a standard module, or Python will attempt to load the script as -a module when that module is imported. This will generally be an error. See -section :ref:`tut-standardmodules` for more information. +* the directory containing the input script (or the current directory). +* :envvar:`PYTHONPATH` (a list of directory names, with the same syntax as the + shell variable :envvar:`PATH`). +* the installation-dependent default. + +This allows Python programs to modify or replace the module search path, but it +is a powerful, and potentially dangerous, tool that is better left in the +experts hands. Note that because the directory containing the script being run +is on the search path, it is important that the script not have the same name as +a standard module, or Python will attempt to load the script as a module when +that module is imported. This will generally be an error. See section +:ref:`tut-standardmodules` for more information. "Compiled" Python files