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
I found myself in a situation where using the
os.pathfamily of functions had better performance characteristics than usingpathlib, which makes sense as pathlib is a wrapper around them. However most programs won't have that bottleneck and pathlib is nice for them.