Showing content from http://mail.python.org/pipermail/python-dev/attachments/20160512/dd232fdc/attachment.html below:
<div dir="ltr"><div><div><div>I am glad this is finally happening. There's quite a bit of noise in the thread which I have to ignore. The two issues that I want to respond to are speed and whether os.fspath() can return bytes.<br><br></div>- Speed: We should trust our ability to optimize the implementations where necessary. First the API issues need to be settled.<br><br></div>- Bytes: I strongly believe that os.fspath() should be a thin wrapper around the __fspath__ protocol, like next() wraps the .__next__ protocol. It should not get into bytes vs. string politics. If your app really needs strings, call os.fsdecode(). So this is my version (unoptimized):<br><br></div><div>def fspath(p: Union[str, bytes, PathLike]) -> Union[str, bytes]:<br></div><div>Â Â Â if isinstance(p, (str, bytes)):<br></div><div>Â Â Â Â Â Â Â return p<br></div><div>Â Â Â try:<br></div><div>Â Â Â Â Â Â Â return p.__fspath__<br></div><div>Â Â Â except AttributeError:<br></div><div>Â Â Â Â Â Â Â raise TypeError(...)<br><br></div>Other than that I think the PEP is already in fine shape.<br clear="all"><div><div><div><div><div><div class="gmail_extra"><br>-- <br><div class="gmail_signature">--Guido van Rossum (<a href="http://python.org/~guido" target="_blank">python.org/~guido</a>)</div>
</div></div></div></div></div></div></div>
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