Issue 42234: pathlib relative_to behaviour change
Issue42234
Created on 2020-11-01 15:48 by armins.bagrats, last changed 2022-04-11 14:59 by admin. This issue is now closed.
| Messages (3) | |||
|---|---|---|---|
| msg380148 - (view) | Author: Armins Stepanjans (armins.bagrats) | Date: 2020-11-01 15:48 | |
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. |
|||
| msg393774 - (view) | Author: Barney Gale (barneygale) * | Date: 2021-05-17 00:19 | |
That does sound pretty useful! I'd be happy to review a PR though I'm not a core dev. |
|||
| msg393776 - (view) | Author: Barney Gale (barneygale) * | Date: 2021-05-17 00:54 | |
In fact, I think this is a duplicate of issue40358, which has an open PR against it. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:59:37 | admin | set | github: 86400 |
| 2022-02-22 23:52:02 | Socob | set | nosy:
+ Socob |
| 2021-06-23 10:41:51 | serhiy.storchaka | set | status: open -> closed superseder: pathlib's relative_to should behave like os.path.relpath resolution: duplicate stage: resolved |
| 2021-05-17 00:54:45 | barneygale | set | messages: + msg393776 |
| 2021-05-17 00:19:20 | barneygale | set | nosy:
+ barneygale messages: + msg393774 |
| 2020-11-01 15:48:23 | armins.bagrats | create | |