Pathlib, Pathlib everywhere.
See original GitHub issueThere are many places where we could make use of Pathlib.
Look for any places that uses with open(...)
and ask yourself:
- is the argument a string ?
- would it make sens to make it a
Path()
, - how far upstream in the code can I make it a Path.
Don’t try to bite more than you can chew (or more than I can review), try to fix 1 place at a time.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:11
- Comments:22 (12 by maintainers)
Top Results From Across the Web
pathlib — Object-oriented filesystem paths — Python 3.11.1 ...
Source code: Lib/pathlib.py This module offers classes representing filesystem paths with ... A path object can be used anywhere an object implementing os....
Read more >Using pathlib.Path, how to efficiently check if a directory ...
Using pathlib.Path, how to efficiently check if a directory resides anywhere under another directory? · How are you measuring "better"? – Scott ...
Read more >Why you should be using pathlib - Trey Hunner
Since Python 3.6, pathlib.Path objects work nearly everywhere you're already using path strings. So I see no reason not to use pathlib if...
Read more >Why Python Pathlib Excels at Handling Files - Built In
The Python pathlib module provides an easier method to interact with the filesystem no matter what the operating system is. It allows a...
Read more >Pathlib | Dev Cheatsheets - Michael Currin
This is useful when running the script from anywhere in or outside the repo and keeping paths relative to that app directory i.e....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi everyone, I’m trying to review all the PRs, there are many tacking this issues, be careful some of you are sending changes for which there are already other PRs opened.
Might also be of use: https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module
There are many places other than
with open()
that might use pathlib treatment: