[Python-Dev] pathlib - current status of discussions (original) (raw)

Ethan Furman ethan at stoneleaf.us
Wed Apr 13 18:58:54 EDT 2016


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



More information about the Python-Dev mailing list