New submission from Domenico Ragusa <>:

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:

Python tracker <>
Python-bugs-list mailing list

Reply via email to