Open NileGraddis opened 5 years ago
I've switched brain_observatory/ecephys to pathlib on branch 673 as an experiment. Thoughts thus far:
Path
, immediately getting some information from it, and then throwing it away.Hmm... yeah it looks like for your use case it might not make as much sense. For me, the strengths of pathlib are:
More explicit _, ext = os.path.splitext(path)
vs. ext = PurePath(path).suffix
I like that Path objects auto normalize so you get Win + POSIX compatibility without having to be careful about mixed slashes
I think best case os
calls may make pathlib
seem superfluous, but pathlib
significantly improves the worst case os
calls (no more os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
shenanigans)
But yeah, was only a suggestion, I think we can adopt and use on a case-by-case basis. It should be another tool in our toolbox.
pathlib offers a nifty object-oriented API and lots of convenience functionality for interacting with fs paths. See the pep for more info.
We can probably replace some or all of our path-munging code with pathlib. It is, however python 3 only.