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-91317: Document that Path does not collapse initial // #32193

Merged
merged 10 commits into from
Jun 10, 2022
7 changes: 5 additions & 2 deletions Doc/library/pathlib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,14 @@ we also call *flavours*:
PureWindowsPath('c:/Program Files')

Spurious slashes and single dots are collapsed, but double dots (``'..'``)
are not, since this would change the meaning of a path in the face of
symbolic links::
and initial double slashes (``'//'``) are not, since this would change the
meaning of a path in the face of symbolic links and UNC (network) paths
respectively::
arhadthedev marked this conversation as resolved.
Show resolved Hide resolved

>>> PurePath('foo//bar')
PurePosixPath('foo/bar')
>>> PurePath('//foo/bar')
PurePosixPath('//foo/bar')
>>> PurePath('foo/./bar')
PurePosixPath('foo/bar')
>>> PurePath('foo/../bar')
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Explicitly documented that :class:`pathlib.PurePath` does not collapse
arhadthedev marked this conversation as resolved.
Show resolved Hide resolved
initial double slashes because they denote UNC paths. Patch by Oleg Iarygin.