(original) (raw)
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.
- Speed: We should trust our ability to optimize the implementations where necessary. First the API issues need to be settled.def fspath(p: Union\[str, bytes, PathLike\]) -> Union\[str, bytes\]:
if isinstance(p, (str, bytes)):
return p
try:
return p.\_\_fspath\_\_
except AttributeError:
raise TypeError(...)
Other than that I think the PEP is already in fine shape.