pathlib vs os.path  [draft]

What’s the difference between Python’s pathlib and os.path modules? If we look at the modules' history we see that os.path has been part of Python’s standard library since time immemorial, whereas pathlib started life as a third-party library and was later incorporated into Python 3.4. Presently, both modules are subject to the same development process, backwards-compatibility guarantees, etc. Looking at the modules' feature sets we find relatively few differences. Each module lets us join and split paths, resolve symlinks, expand home directories, etc....

January 2, 2022