When I first encountered Python’s pathlib module for path manipulation, I brushed it aside
assuming it to be just an OOP way of doing what os.path already does quite well. The
official doc also dubs it as the Object-oriented filesystem paths. However, back in 2019
when an issue confirmed that Django was replacing os.path with pathlib, I got curious.
The os.path module has always been the de facto standard for working with paths in Python.
But the API can feel massive as it performs a plethora of other loosely coupled system
related jobs. I’ve to look things up constantly even to perform some of the most basic tasks
like joining multiple paths, listing all the files in a folder having a particular
extension, opening multiple files in a directory etc. The pathlib module can do nearly
everything that os.path offers and comes with some additional cherries on top.