[New-bugs-announce] [issue40358] pathlib's relative_to should behave like os.path.relpath

Domenico Ragusa report at bugs.python.org
Tue Apr 21 20:03:03 EDT 2020


New submission from Domenico Ragusa <domenicoragusa at gmail.com>:

Can we improve pathlib.relative_to(other) so that it handles the case of a path not being a direct child of other, like os.path.relpath?

For example:
Path('/some/thing').relative_to('/foo') -> Path('../some/thing')

At the moment it just raises an exception.

----------
components: Library (Lib)
files: pathlib.diff
keywords: patch
messages: 366958
nosy: Domenico Ragusa
priority: normal
severity: normal
status: open
title: pathlib's relative_to should behave like os.path.relpath
type: enhancement
versions: Python 3.9
Added file: https://bugs.python.org/file49081/pathlib.diff

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


More information about the New-bugs-announce mailing list