开发者

Will the real path.py please stand up?

开发者 https://www.devze.com 2023-01-19 15:03 出处:网络
There was a good module, path.py, written by Jason Orendorff. If I recall correctly, there was some discussion about adding it to the standard library then it faded away.

There was a good module, path.py, written by Jason Orendorff. If I recall correctly, there was some discussion about adding it to the standard library then it faded away.

It looks now that there are multiple outgrowths of the original one. I can find so far unipath开发者_JAVA技巧, what looks like a forked path.py, another one, and a few others according to PyPI.

Anyone has experience with any of those options? Is one better than the other in terms of functionality, maintenance or any other criteria? Or should I just pick one at random?

(Apologies for the whimsical title. I first went for "Which path.py?" but it was too short for SO's taste.)


I've also been a fan of this module for quite some time. This one seems to have the most recent commits, and also to be true to the original form -- which really, I like best of the different versions I've tried. Installable using pip install path.py

edit: Looks like as of python 3.4 (and backported to 2.7 on PYPI), there's a standard lib path module called pathlib. It's not nearly as extensive as some of the path modules are, but it benefits from the lack of clutter, and it is a well-thought-out path implementation, retaining some of the best base qualities of quite a few of the path libraries that are out there. Particularly of note, it cleanly handles the differences between different OS paths (Windows and Posix), and seems like a good clean tool that's worth a look. Regardless of whether it has every feature one could ever want or not (it doesn't), it's nice that Python finally has a good standard path implementation.


All path.py fans stand up!

Since Python 3.4, a module is dealing with paths, module pathlib. It is based on PEP 428, and heavily inspired from our beloved path.py, though seems to take some different approach notably on a strong distinction between Windows path and Unix path.

0

精彩评论

暂无评论...
验证码 换一张
取 消