[New-bugs-announce] [issue42234] pathlib relative_to behaviour change

Armins Stepanjans report at bugs.python.org
Sun Nov 1 10:48:23 EST 2020


New submission from Armins Stepanjans <armins.bagrats at gmail.com>:

In the docs (https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.relative_to) PurePath.relative_to() is specified to fail for arguments that are not on the original path (e.g. Path('/ham/beans').relative_to(Path('/spam'))).

I believe it would be useful to extend the behaviour of relative_to so that it handles the case above. For example, I would expect Path('/ham/beans').relative_to(Path('/spam')) to return Path('../ham/beans').

If this sounds like a useful change I'd be happy to make a PR for it.

----------
components: Library (Lib)
messages: 380148
nosy: armins.bagrats
priority: normal
severity: normal
status: open
title: pathlib relative_to behaviour change
type: behavior
versions: Python 3.10

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


More information about the New-bugs-announce mailing list