Should you be using Pathlib?
I've been working in Python for four years - recently I made the conscious choice to use pathlib rather than the more familiar os & os.path.
It's been a great experience - I wrote a short piece (friend link) comparing the two libraries on common workflows & tasks done with file paths.
22 comments · 89% upvoted · other discussions
Ok, it's more clear now.
It's just not its purpose. It's just a more simple abstraction layer on top of different libs: os. so.path, shutil, glob, ...
Not as complete as each of them but more consistent and pythonic.
It's the point. You can always switch to string manipulation, and as mentioned in the first comment, we can always use it with other frameworks but we would like an extended interface to avoid it.
For this particular use case there is maybe a PEP to provide a new method for this kind of replacement but I'm not sure it's useful. What did you expect for this ?
Don't use it, so. Some other people enjoy it.
jorge1209 1 points · Feb 2021
And where did I say that those who like
pathlibare child rapists and cannibals? You seem to be implying that my dislike for the library is some kind of terrible attack.The person I was responding to was saying they were looking forward to the day when
os.pathgoes away. I'm telling them that they are going to be waiting a long time, because we are not all convinced to switch.krazybug 1 points · Feb 2021
There is some misunderstanding. Disclaimer: English is not my native tongue.
I just answered that for some people, this library is useful.
And as it is now part of the stdlib, it could be nice to get a better support from some frameworks at the API level.
jorge1209 1 points · Feb 2021
It would be nice if the python stdlib wasnt a complete mess, and if people actually took the time to curate and maintain it, but they don't.