Preamble

pathlib.Path is the object-oriented face of filesystem paths in modern Python: join with /, glob with **, read text in one call when appropriate. os.path remains everywhere in legacy code. This note compares ergonomics and offers a light performance sanity check—mostly to confirm that kernel and disk dominate when you recurse large trees.


Ergonomics

Path.glob("**/*.py") reads closer to intent than os.walk plus string join. APIs that return Path end-to-end play nicely with type checkers and reduce “stringly typed” path bugs on Windows vs POSIX.


Performance reality

For filesystem-heavy jobs, syscall volume and storage latency swamp pure-Python differences. Pick pathlib in new code unless you interface with C extensions that insist on str, or you maintain stdlib-minimal scripts.


Literacy

Keep os.path literacy for reading older modules and translating shell snippets—deprecation of mental models is slower than deprecation of APIs.


Conclusion

pathlib for new code; os.path for archaeology. Java Collections Compared to Python’s Built-in Containers compares Java Collections to Python containers at the Big-O vocabulary level.