Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-68654: Clarify subdirectories used by pkgutil.extend_path #103701

Merged
merged 1 commit into from
Apr 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Doc/library/pkgutil.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ support.
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)

This will add to the package's ``__path__`` all subdirectories of directories
on :data:`sys.path` named after the package. This is useful if one wants to
distribute different parts of a single logical package as multiple
For each directory on :data:`sys.path` that has a subdirectory that matches the
package name, add the subdirectory to the package's :attr:`__path__`. This is useful
if one wants to distribute different parts of a single logical package as multiple
directories.

It also looks for :file:`\*.pkg` files beginning where ``*`` matches the
Expand Down
8 changes: 4 additions & 4 deletions Lib/pkgutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,10 +511,10 @@ def extend_path(path, name):
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)

This will add to the package's __path__ all subdirectories of
directories on sys.path named after the package. This is useful
if one wants to distribute different parts of a single logical
package as multiple directories.
For each directory on sys.path that has a subdirectory that
matches the package name, add the subdirectory to the package's
__path__. This is useful if one wants to distribute different
parts of a single logical package as multiple directories.

It also looks for *.pkg files beginning where * matches the name
argument. This feature is similar to *.pth files (see site.py),
Expand Down