[Python-Dev] file system path protocol PEP

Brett Cannon brett at python.org
Thu May 12 17:34:04 EDT 2016


On Thu, 12 May 2016 at 14:04 Sjoerd Job Postmus <sjoerdjob at sjoerdjob.com>
wrote:

>
>
> > On 12 May 2016, at 21:30, Ethan Furman <ethan at stoneleaf.us> wrote:
> >
> > If you need bytes support for your paths, there's at least one [1] that
> has that support.
>
> So if I would need bytes support, I should submit a pull request to
> <arbitrary but awesome library> which replaces usage of the stdlib pathlib
> with another variant, upon which they will decline the pull request because
> it introduces another "useless" dependency.
>

No, what you should do is ask them to create the pathlib instance lazily
and only when duck typing shows they weren't given a compatible object.
Then you could pass in some bytes-based solution like Ethan's and not worry
about pathlib's refusal to work with bytes. Or you simply ask them to work
with os.path after calling os.fspath() and be very careful to not use any
strings with the functions.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20160512/ae3370ee/attachment.html>


More information about the Python-Dev mailing list