What about code that depends on __file__ to add installation dependent import paths to sys.path?  I have written code like that myself, and I've seen it elsewhere too.


On 8/20/2020 9:06 PM, Christopher Barker 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
  - Teaching
  - Scientific Software Development
  - Desktop GUI and Web Development
  - wxPython, numpy, scipy, Cython

Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-leave@python.org
Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/GIKHETWTXPG5CM54QV5RIHII57HUVMRM/
Code of Conduct: http://python.org/psf/codeofconduct/