[Python-ideas] Working with Path objects: p-strings?

Koos Zevenhoven k7hoven at gmail.com
Sun Mar 27 10:40:34 EDT 2016


On Sun, Mar 27, 2016 at 1:23 AM, Koos Zevenhoven <k7hoven at gmail.com> wrote:

> On Sat, Mar 26, 2016 at 9:10 PM, Brett Cannon <brett at python.org> wrote:
>
>>
>> I also want to mention two things. One, pathlib.path is a thing now and
>> something most people are probably not aware of as an alternative to doing
>> `str(path)`:
>> https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.path .
>>
>
> I assume you meant to type pathlib.Path.path, so that Path("...").path ==
> str(Path("...")). That's a good start, and I'm looking forward to Serhiy's
> patch for making the stdlib accept Paths. But if Path will not subclass
> str, we also need new stdlib functions that *return* Paths.
>
>
Actually, now that .path is not out yet, would it make sense to call it
Path.str or Path.strpath instead, and introduce the same thing on DirEntry
and guarantee a str (instead of str or bytes as DirEntry.path now does)?
Maybe that would lead to fewer broken implementations in third-party
libraries too?

 - Koos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160327/af3d836e/attachment.html>


More information about the Python-ideas mailing list