GH-100502: Add pathlib.PurePath.pathmod attribute#106533
GH-100502: Add pathlib.PurePath.pathmod attribute#106533barneygale merged 7 commits intopython:mainfrom
pathlib.PurePath.pathmod attribute#106533Conversation
This instance attribute stores the implementation of `os.path` used for low-level path operations: either `posixpath` or `ntpath`. The `PurePath` and `Path` initialisers gain a *flavour* keyword-only argument. This argument is not available in the Posix- and Windows-specific subclasses, and as the `PurePath` and `Path` classes are not directly instantiable, it is available therefore only in user subclasses of `PurePath` and `Path`. Such subclasses may determine their flavour in `__init__()` and supply the flavour to `super()`.
pathlib.PurePath.flavour attributepathlib.PurePath.pathmod attribute
|
Thank you for the review, @merwok! |
…thonGH-106533)" This reverts commit c6c5665.
|
Pardon the bump, but I figured this PR might be a good place to ask. @barneygale is there a specific reason why e.g. |
|
Alternatively, if your subclass is not concerned with the local filesystem, you could subclass from |
|
Thanks for the explanation, that makes sense. Curiosity satisfied :) I must admit that our use-case and restrictions are quite unique, overriding the methods as we need is indeed what we do now. Thanks for linking |
This class attribute stores the implementation of
os.pathused for low-level path operations: eitherposixpathorntpath.📚 Documentation preview 📚: https://cpython-previews--106533.org.readthedocs.build/