On 05/29/2017 09:55 AM, Serhiy Storchaka wrote:
29.05.17 00:33, Wolfgang Maier пише:
The path protocol does *not* use __fspath__ as an indicator that an object's str-representation is intended to be used as a path. If you had wanted this, the PEP should have defined __fspath__ not as a method, but as a flag and have the protocol check that flag, then call __str__ if appropriate.

__fspath__ is a method because there is a need to support bytes paths. __fspath__() can return a bytes object, str() can't.


That's certainly one reason, but again just shows that calling str(path_object) to get a path representation is wrong.

_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to