Skip to content

Commit 7f00574

Browse files
authored
gh-88330: Add more detail about what is a resource. (#99801)
1 parent 93f22d3 commit 7f00574

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

Doc/library/importlib.resources.rst

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,17 @@
1111
.. versionadded:: 3.7
1212

1313
This module leverages Python's import system to provide access to *resources*
14-
within *packages*. If you can import a package, you can access resources
15-
within that package. Resources can be opened or read, in either binary or
16-
text mode.
14+
within *packages*.
15+
16+
"Resources" are file-like resources associated with a module or package in
17+
Python. The resources may be contained directly in a package or within a
18+
subdirectory contained in that package. Resources may be text or binary. As a
19+
result, Python module sources (.py) of a package and compilation artifacts
20+
(pycache) are technically de-facto resources of that package. In practice,
21+
however, resources are primarily those non-Python artifacts exposed
22+
specifically by the package author.
23+
24+
Resources can be opened or read in either binary or text mode.
1725

1826
Resources are roughly akin to files inside directories, though it's important
1927
to keep in mind that this is just a metaphor. Resources and packages **do
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Improved the description of what a resource is in importlib.resources docs.

0 commit comments

Comments
 (0)