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
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to