[Python-Dev] file system path protocol PEP (original) (raw)
Sven R. Kunze srkunze at mail.de
Fri May 13 03:58:13 EDT 2016
- Previous message (by thread): [Python-Dev] file system path protocol PEP
- Next message (by thread): [Python-Dev] file system path protocol PEP
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 12.05.2016 18:24, Guido van Rossum wrote:
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(...)
@Brett Would you think it makes sense to swap the str/bytes check and the fspath check?
I just thought of a class subclassing str/bytes and defines fspath. Its fspath method would be ignored currently.
Best, Sven
- Previous message (by thread): [Python-Dev] file system path protocol PEP
- Next message (by thread): [Python-Dev] file system path protocol PEP
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]