[Python-ideas] find-like functionality in pathlib

Chris Barker - NOAA Federal chris.barker at noaa.gov
Wed Jan 6 23:35:00 EST 2016


The PermissionError bug you found is already reported
>

I committed this fix.

Thanks!

I also added a .path attribute to pathlib.*Path objects, so that p.path ==
str(p). You can now use the idiom getattr(arg, 'path', arg) to extract the
path from a pathlib.Path object, or from an os.DirEntry object, or fall
back to a plain string, without using str(arg), which would turn *any*
object into a string, which is never what you want to happen by default.


Very nice -- that opens the door to stdlib and third party modules taking
Path objects in addition to strings. Maybe we will see greater adoption of
pathlib after all!

CHB




These changes will be released in Python 3.4.5, 3.5.2 and 3.6.

-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160106/c116cffc/attachment.html>


More information about the Python-ideas mailing list