A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2016-May/144560.html below:

[Python-Dev] file system path protocol PEP

[Python-Dev] file system path protocol PEPSjoerd Job Postmus sjoerdjob at sjoerdjob.com
Thu May 12 13:22:25 EDT 2016
I would like to make just 1 comment regarding the question of accepting
(or not) bytes as output of `os.fspath`.

The whole point of adding `os.fspath` is to make it easier to use Path
objects. This is in an effort to gain greater adoption of pathlib in
libraries. Now, this is an excellent idea.

However, if it were to reject bytes, that would mean that when libraries
start to use pathlib, it would suddenly become harder for people that
actually need bytes-support to use pathlib.

Now, the claim 'if you need bytes, you should not be using pathlib` is a
reasonable one. But what if I need bytes *and* a specific library (say,
image handling, or a web framework, or ...). It's not up to me if that
library uses pathlib or plain old os.path.join.

Is using surrogate-escapes enough for this case? I myself am not sure,
(and also not affected), but it sounds to me that rejecting bytes is a
wrong approach if there is no proper workaround (assuming the use-case
of pathlib is somewhere deep in library code).

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4