<p dir="ltr">Does path.py have different performance in this respect?</p>
<p dir="ltr">I like the Path.isdir(), Path.walk() methods; but maybe not for everyone.</p>
<p dir="ltr">Way OT, but similar support for URIs (e.g. URLObject) would likely need to take a similar approach: <a href="http://www.reddit.com/r/Python/comments/1r7h1t/python_objects_for_working_with_urls_and_uris/">http://www.reddit.com/r/Python/comments/1r7h1t/python_objects_for_working_with_urls_and_uris/</a></p>
<div class="gmail_quote">On Oct 6, 2014 12:50 PM, "Barry Warsaw" <<a href="mailto:barry@python.org">barry@python.org</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Over in issue 22570, I lament the fact that while pathlib is awesome, its<br>
wider support in the stdlib is pretty sparse.  I've tried to convert parts of<br>
a medium sized Python 3 application from os.path to pathlib and found this<br>
lack of support rather demotivating.  Yes, it's fairly easy to wrap Path<br>
objects in str() to pass them to stdlib methods that expect only strings, but<br>
it's a lot of work in user code and I find that the resulting str()s are<br>
distracting.  It's a disincentive.<br>
<br>
Antoine provided a link to a previous discussion[*] but that didn't go very<br>
far.<br>
<br>
One simple solution would be to sprinkle str() calls in various stdlib<br>
methods, but I'm not sure if that would fail miserably in the face of bytes<br>
paths (if the original stdlib API even accepts bytes paths).  The suggestion<br>
in the issue is to add a "path protocol" and the referenced article suggests<br>
.strpath and .bytespath.  OTOH, isn't str() and bytes() enough?<br>
<br>
I don't have any other brilliant ideas, but I opened the issue and am posting<br>
here to see if we can jump start another discussion for Python 3.5.  I'd<br>
*like* to use more Paths, but not at the expense of my own code's readability.<br>
Yes, I'd sacrifice a bit of readability in the stdlib, especially if that<br>
would cover more use cases.<br>
<br>
Cheers,<br>
-Barry<br>
<br>
[*] <a href="https://mail.python.org/pipermail/python-ideas/2014-May/027869.html" target="_blank">https://mail.python.org/pipermail/python-ideas/2014-May/027869.html</a><br>
<br>_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" target="_blank">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" target="_blank">http://python.org/psf/codeofconduct/</a><br></blockquote></div>