Skip to content

Commit e0cfbae

Browse files
authored
Doc: clarify when to use pathlib pure paths
Added explanation of when pure paths are appropriate to help beginners understand the difference between pure and concrete paths.
1 parent c521597 commit e0cfbae

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Doc/library/pathlib.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ right for your task, :class:`Path` is most likely what you need. It instantiates
3333
a :ref:`concrete path <concrete-paths>` for the platform the code is running on.
3434

3535
Pure paths are useful in some special cases; for example:
36+
#. Pure path objects provide path-handling operations which don't actually
37+
access a filesystem.
38+
Use pure paths when you need to manipulate path strings
39+
without requiring the path to exist on disk,such as when generating paths
40+
for remote systems or validating path formats.
3641

3742
#. If you want to manipulate Windows paths on a Unix machine (or vice versa).
3843
You cannot instantiate a :class:`WindowsPath` when running on Unix, but you

0 commit comments

Comments
 (0)