On 04/13/2016 03:45 PM, Nikolaus Rath wrote:
When passing an object that is of type str and has a __fspath__
attribute, all approaches return the value of __fspath__().
However, when passing something of type bytes, the second approach
returns the object, while the third returns the value of __fspath__().
Is this intentional? I think a __fspath__ attribute should always be
preferred.
Yes, it is intentional. The second approach assumes __fspath__ can only
contain str, so there is no point in checking it for bytes.
--
~Ethan~
_______________________________________________
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