I have no idea how hard/bad/maintenance heavy this would be, but wouldn't the easy way be simply to provide another attribute (e.g. __path__) with what you want and maintain __file__?
I've never used a Path object (directly), I feel like I'm missing out now!
On Fri, 21 Aug 2020 at 02:09, Christopher Barker email@example.com wrote:
I really like pathlib.
But for a while is was painful to use, 'cause there was som much code that still used strings for paths. That was made a lot better when we introduced the __fspath__ protocol, and then updated the standard library to use it (everywhere?).
But there are still a few that bug me. For instance:
__file__ is a path represented as a string. It's not too big a deal to wrap it in Path(), but it still annoys me.
So: would it be entirely too disruptive to replace these kinds of things with Path objects?
-- Christopher Barker, PhD
Python Language Consulting
- Scientific Software Development
- Desktop GUI and Web Development
- wxPython, numpy, scipy, Cython
Python-ideas mailing list -- firstname.lastname@example.org To unsubscribe send an email to email@example.com https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://firstname.lastname@example.org/message/GIKHET... Code of Conduct: http://python.org/psf/codeofconduct/