[Python-Dev] Defining a path protocol (was: When should pathlib stop being provisional?) (original) (raw)
Victor Stinner victor.stinner at gmail.com
Fri Apr 8 09:56:04 EDT 2016
- Previous message (by thread): [Python-Dev] Defining a path protocol (was: When should pathlib stop being provisional?)
- Next message (by thread): [Python-Dev] Defining a path protocol (was: When should pathlib stop being provisional?)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I like fspath because it looks like os.fsencode() and os.fsdecode().
Please no builtin function, we have enough of them, but make sure that the fspath is accepted in all functions expecting a filename.
If you consider that a function would make your change simpler, I suggest to add os.fspath():
if isinstance(obj, str): return obj try: return obj.fspath except AttributeError: raise TypeError(...)
Victor -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20160408/dcb4ed62/attachment.html>
- Previous message (by thread): [Python-Dev] Defining a path protocol (was: When should pathlib stop being provisional?)
- Next message (by thread): [Python-Dev] Defining a path protocol (was: When should pathlib stop being provisional?)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]