[Python-checkins] peps: Amend the collapsing the leading slashes to account for the POSIX special case
antoine.pitrou
python-checkins at python.org
Sat Dec 29 01:48:47 CET 2012
http://hg.python.org/peps/rev/6813e83ee36c
changeset: 4639:6813e83ee36c
user: Antoine Pitrou <solipsis at pitrou.net>
date: Sat Dec 29 01:46:48 2012 +0100
summary:
Amend the collapsing the leading slashes to account for the POSIX special case of two leading slashes.
Thanks to Daniel Colascione for noticing.
files:
pep-0428.txt | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/pep-0428.txt b/pep-0428.txt
--- a/pep-0428.txt
+++ b/pep-0428.txt
@@ -292,19 +292,29 @@
PurePosixPath('a/../b')
Multiple leading slashes are treated differently depending on the path
-flavour::
+flavour. They are always retained on Windows paths (because of the UNC
+notation)::
- >>> PurePosixPath('//some/path')
- PurePosixPath('/some/path')
>>> PureNTPath('//some/path')
PureNTPath('\\\\some\\path\\')
+On POSIX, they are collapsed except if there are exactly two leading slashes,
+which is a special case in the POSIX specification on `pathname resolution`_
+(this is also necessary for Cygwin compatibility)::
+
+ >>> PurePosixPath('///some/path')
+ PurePosixPath('/some/path')
+ >>> PurePosixPath('//some/path')
+ PurePosixPath('//some/path')
+
Calling the constructor without any argument creates a path object pointing
to the logical "current directory"::
>>> PurePosixPath()
PurePosixPath('.')
+.. _pathname resolution: http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap04.html#tag_04_11
+
Representing
------------
--
Repository URL: http://hg.python.org/peps
More information about the Python-checkins
mailing list