Mailing List Archive

[3.12] gh-117074: Update Traversable.joinpath docs to the 3.11+ protocol (GH-117113) (GH-117571)
https://github.com/python/cpython/commit/558b517bb571999ef36123635e0245d083a28305
commit: 558b517bb571999ef36123635e0245d083a28305
branch: 3.12
author: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
committer: encukou <encukou@gmail.com>
date: 2024-04-05T17:33:52+02:00
summary:

[3.12] gh-117074: Update Traversable.joinpath docs to the 3.11+ protocol (GH-117113) (GH-117571)

gh-117074: Update Traversable.joinpath docs to the 3.11+ protocol (GH-117113)
(cherry picked from commit e569f9132b5bdc1c103116a020e19e3ccc20cf34)

Co-authored-by: Petr Viktorin <encukou@gmail.com>

files:
M Doc/library/importlib.resources.abc.rst

diff --git a/Doc/library/importlib.resources.abc.rst b/Doc/library/importlib.resources.abc.rst
index c508b6ba965cc0..c25c48530722e6 100644
--- a/Doc/library/importlib.resources.abc.rst
+++ b/Doc/library/importlib.resources.abc.rst
@@ -109,13 +109,35 @@

Return True if self is a file.

- .. abstractmethod:: joinpath(child)
+ .. abstractmethod:: joinpath(*pathsegments)

- Return Traversable child in self.
+ Traverse directories according to *pathsegments* and return
+ the result as :class:`!Traversable`.
+
+ Each *pathsegments* argument may contain multiple names separated by
+ forward slashes (``/``, ``posixpath.sep`` ).
+ For example, the following are equivalent::
+
+ files.joinpath('subdir', 'subsuddir', 'file.txt')
+ files.joinpath('subdir/subsuddir/file.txt')
+
+ Note that some :class:`!Traversable` implementations
+ might not be updated to the latest version of the protocol.
+ For compatibility with such implementations, provide a single argument
+ without path separators to each call to ``joinpath``. For example::
+
+ files.joinpath('subdir').joinpath('subsubdir').joinpath('file.txt')
+
+ .. versionchanged:: 3.11
+
+ ``joinpath`` accepts multiple *pathsegments*, and these segments
+ may contain forward slashes as path separators.
+ Previously, only a single *child* argument was accepted.

.. abstractmethod:: __truediv__(child)

Return Traversable child in self.
+ Equivalent to ``joinpath(child)``.

.. abstractmethod:: open(mode='r', *args, **kwargs)


_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-leave@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: list-python-checkins@lists.gossamer-threads.com