[issue39090] Document various options for getting the absolute path from pathlib.Path objects

Floris Lambrechts report at bugs.python.org
Tue Feb 25 02:44:09 EST 2020


Floris Lambrechts <florisla at gmail.com> added the comment:

Based on the feedback received in GitHub here:
https://github.com/florisla/cpython/commit/c146ad3d086fe9e401284c12fc670ea4f9398f3b

I made a new revision of the 'Absolute paths' chapter here:
https://github.com/florisla/cpython/blob/pathlib-chapter-absolute-paths-2/Doc/library/pathlib.rst#absolute-paths

Further feedback is welcome.

Changes:

* Be more 'in your face' about Path.resolve() being the recommended
  approach.
* Add separate section on Windows considerations
* Explain difference between Path.resolve() and os.path.isabs() w.r.t.
  checking for drive.
* Refer to 'mapped share' instead of 'mapped network share'.
* Explain replacement of substitute drive with final path.
* Mention os.path.abspath's upcasing of drive letter in case of
  a path missing a root.
* Mention different handling of junctions versus symlinks w.r.t.
  relative parts.

For brevity, I've kept the wording on substitute drive and handling of
junctions very short.

For the same reason I did not not include eryksun's (interesting!) info
on why mapped and substitute drives are non-canonical.

Not mentioning Path.resolve()'s behavior w.r.t. non-existing files since
that's documented in resolve() itself.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39090>
_______________________________________


More information about the Python-bugs-list mailing list