barneygale / pathlib-abc

Python base classes for rich path objects
Other
23 stars 1 forks source link

Rename `pathmod` / `PathModuleBase` #19

Closed barneygale closed 3 months ago

barneygale commented 6 months ago

We now have an ABC for PurePathBase.pathmod called PathModuleBase - see https://pathlib-abc.readthedocs.io/en/latest/api.html#controlling-path-syntax

The naming here made sense for when posixpath and ntpath were the only possible values for pathmod, but with the addition of the PathModuleBase class, the "mod" bit isn't appropriate.

We should rename pathmod and PathModuleBase, hopefully before Python 3.13 beta 1 goes out.

barneygale commented 6 months ago

Tagging you @merwok in case this interests you or you have any suggestions/thoughts. Hope that's OK! Thanks.

barneygale commented 6 months ago

Name ideas: flavour, format, formatter, structure, manipulator, grammar, syntax, parser

merwok commented 6 months ago

flavour, impl (for «object implementing operations»), manipulator

barneygale commented 6 months ago

impl (for «object implementing operations»)

PathModuleBase only implements pure (lexical) operations, but if it's inherited into Path as Path.impl, I think it would incorrectly suggest that it's used to implement all path functionality, including I/O.

merwok commented 6 months ago

Indeed, I thought it was doing that, like accessor used to.

I don’t think it’s very bad to have pathmod, especially if it names an object implementing a PathModuleBase ABC! If you feel that the names are misleading, both should be changed in agreement.

ap-- commented 6 months ago

Hello everyone,

~If I remember correctly from the thread on discuss.python.org the name pathmod was chosen because the posixpath and ntpath modules were the two options for the path 'flavours'.~ (just saw that it's mentioned in the first post in the issue)

To me personally, "format", "flavour", "syntax" or "parser" are more intuitive.

Cheers, Andreas

barneygale commented 6 months ago

I like "flavour" tbh. Antoine used "flavour" in this way too when he wrote pathlib (I/O was done by the "accessor").

merwok commented 6 months ago

So flavour for a module with functions, or object with methods, and PathFlavourBase for the interface (ABC) ?

barneygale commented 6 months ago

Correct. Or just FlavourBase for the ABC, I suppose.