diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2022-11-26 21:57:20 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-26 21:57:20 (GMT) |
commit | 7f005749b27c7b9108ea24e5c0ff25068910b75c (patch) | |
tree | 95e1ebffbf2693daff05b90692f1b1b4c19fd731 | |
parent | 93f22d30eb7bf579d511b1866674bc1c2513dde9 (diff) | |
download | cpython-7f005749b27c7b9108ea24e5c0ff25068910b75c.zip cpython-7f005749b27c7b9108ea24e5c0ff25068910b75c.tar.gz cpython-7f005749b27c7b9108ea24e5c0ff25068910b75c.tar.bz2 |
gh-88330: Add more detail about what is a resource. (#99801)
-rw-r--r-- | Doc/library/importlib.resources.rst | 14 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Documentation/2022-11-26-15-51-23.gh-issue-88330.B_wFq8.rst | 1 |
2 files changed, 12 insertions, 3 deletions
diff --git a/Doc/library/importlib.resources.rst b/Doc/library/importlib.resources.rst index 827e7d8..3991913 100644 --- a/Doc/library/importlib.resources.rst +++ b/Doc/library/importlib.resources.rst @@ -11,9 +11,17 @@ .. versionadded:: 3.7 This module leverages Python's import system to provide access to *resources* -within *packages*. If you can import a package, you can access resources -within that package. Resources can be opened or read, in either binary or -text mode. +within *packages*. + +"Resources" are file-like resources associated with a module or package in +Python. The resources may be contained directly in a package or within a +subdirectory contained in that package. Resources may be text or binary. As a +result, Python module sources (.py) of a package and compilation artifacts +(pycache) are technically de-facto resources of that package. In practice, +however, resources are primarily those non-Python artifacts exposed +specifically by the package author. + +Resources can be opened or read in either binary or text mode. Resources are roughly akin to files inside directories, though it's important to keep in mind that this is just a metaphor. Resources and packages **do diff --git a/Misc/NEWS.d/next/Documentation/2022-11-26-15-51-23.gh-issue-88330.B_wFq8.rst b/Misc/NEWS.d/next/Documentation/2022-11-26-15-51-23.gh-issue-88330.B_wFq8.rst new file mode 100644 index 0000000..0f242ee --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2022-11-26-15-51-23.gh-issue-88330.B_wFq8.rst @@ -0,0 +1 @@ +Improved the description of what a resource is in importlib.resources docs. |