[Python-Dev] file system path protocol PEP

Chris Angelico rosuav at gmail.com
Fri May 13 06:54:05 EDT 2016


On Fri, May 13, 2016 at 8:19 PM, Steven D'Aprano <steve at pearwood.info> wrote:
> I feel this is Not Our Problem. Surely the stdlib cannot be held
> responsible for all the poor decisions made by third-party libraries? If
> a library hard-codes "\\" as their directory separator, because everyone
> uses Windows, you'd simply say "this library is not very good for my
> use-case". Likewise if it rejects bytes paths, then:
>
> - perhaps that library is not fit for your purpose;
>
> - perhaps you can use it, but with the limitation that you can no
>   longer support all paths, but only the ones which can be
>   accessed via a string path;
>
> - perhaps you can build a compatibility layer that lets you use
>   both bytes and the library.

AFAICT, the compatibility layer would simply decode the bytes using
surrogateescape handling, which should round-trip anything.

Or am I wrong here somewhere?

ChrisA


More information about the Python-Dev mailing list