File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -365,6 +365,23 @@ Pure paths provide the following methods and properties:
365365 ''
366366
367367
368+ .. data :: PurePath.path
369+
370+ A string representing the full path::
371+
372+ >>> PurePosixPath('my/library/setup.py').path
373+ 'my/library/setup.py'
374+
375+ This always returns the same value as ``str(p) ``; it is included to
376+ serve as a one-off protocol. Code that wants to support both
377+ strings and ``pathlib.Path `` objects as filenames can write
378+ ``arg = getattr(arg, 'path', arg) `` to get the path as a string.
379+ This can then be passed to various system calls or library
380+ functions that expect a string. Unlike the alternative
381+ ``arg = str(arg) ``, this will still raise an exception if an object
382+ of some other type is given by accident.
383+
384+
368385.. data :: PurePath.suffix
369386
370387 The file extension of the final component, if any::
You can’t perform that action at this time.
0 commit comments