Skip to content

Commit fd16e8a

Browse files
更新 import.rst
Co-authored-by: Stan Ulbrych <stan@python.org>
1 parent 70c4ca3 commit fd16e8a

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

Doc/reference/import.rst

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -665,12 +665,14 @@ shared libraries (e.g. ``.so`` files). When supported by the :mod:`zipimport`
665665
module in the standard library, the default path entry finders also handle
666666
loading all of these file types (other than shared libraries) from zipfiles.
667667

668-
Within a single file system path entry, the default finder checks for regular
669-
packages before same-named modules. For example, if the same directory contains
670-
both ``spam/__init__.py`` and ``spam.py``, ``import spam`` will import the
671-
package from ``spam/__init__.py``. This does not override the order of
672-
:data:`sys.path`: a module found in an earlier path entry still takes precedence
673-
over a package found in a later one.
668+
Within a single :term:`path entry`, the default path entry finders check for a
669+
:term:`regular package` first, then for extension modules, then for source
670+
files, and finally for bytecode files. For example, if the same directory
671+
contains both ``spam/__init__.py`` and ``spam.py``, ``import spam`` will
672+
import the package from ``spam/__init__.py``. A directory without an
673+
``__init__.py`` file is treated as a :term:`namespace package` portion only if
674+
no matching module is found. Note that this does not override the order of the
675+
:term:`import path`.
674676

675677
Path entries need not be limited to file system locations. They can refer to
676678
URLs, database queries, or any other location that can be specified as a

0 commit comments

Comments
 (0)