On Fri, May 13, 2016, at 07:00, Steven D'Aprano wrote: > - but os.fspath() will only return str; > > - and os.fspathb() will only return bytes;
And raise an exception if __fspath__ returns the other, I suppose. What's the use case for these functions? When would I call them rather than fsdecode and fsencode? (assuming the latter will support the path protocol - I've got more objections if they're not going to) Also, what happens if you pass a string to os.fspath? Statements like "str will not implement __fspath__" have thus far been light on details of what functions will accept "str or path-like-object-whose-__fspath__returns-str" and which ones will only accept the latter (and what, if any, will continue to only accept the former). If no-one's supposed to directly call dunder methods, and os.fspath accepts str, then what difference does it make whether this is implemented by having a special case within os.fspath or by calling str.__fspath__? _______________________________________________ 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