classification
Title: Remove pathlib flavours
Type: behavior Stage: patch review
Components: Library (Lib) Versions: Python 3.11
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: pitrou Nosy List: barneygale, pitrou
Priority: normal Keywords: patch

Created on 2021-05-14 18:28 by barneygale, last changed 2021-06-13 18:25 by barneygale.

Pull Requests
URL Status Linked Edit
PR 26141 closed barneygale, 2021-05-15 08:21
PR 26708 open barneygale, 2021-06-13 16:55
Messages (2)
msg393685 - (view) Author: Barney Gale (barneygale) * Date: 2021-05-14 18:28
Following bpo-39899, bpo-43757 and bpo-43012, `pathlib._Flavour` and its subclasses are looking a bit pointless.

The implementations of `is_reserved()` and `make_uri()` (~`as_uri()`) can be readily moved to into `PurePosixPath` and `PureWindowsPath`, which removes some indirection. This follows the pattern of OS-specific stuff in `PosixPath` and `WindowsPath`.

The remaining methods, such as `splitroot()`, can be pulled into `Pure*Path` with an underscore prefix.

I'm generally a believer in composition over inheritance, but in this case `_Flavour` seems too small and too similar to `PurePath` to separate out into 3 extra classes.

There should be no impact on public APIs or performance.
msg395759 - (view) Author: Barney Gale (barneygale) * Date: 2021-06-13 18:25
Depends: bpo-39899, bpo-43757, bpo-44316, bpo-44403, bpo-44412
History
Date User Action Args
2021-06-13 18:25:31barneygalesetmessages: + msg395759
2021-06-13 16:55:20barneygalesetpull_requests: + pull_request25297
2021-05-15 17:55:09rhettingersetassignee: pitrou

nosy: + pitrou
2021-05-15 08:21:18barneygalesetkeywords: + patch
stage: patch review
pull_requests: + pull_request24776
2021-05-14 18:28:58barneygalecreate