[Python-Dev] Pathlib enhancements - acceptable inputs and outputs for __fspath__ and os.fspath()

Ethan Furman ethan at stoneleaf.us
Mon Apr 18 15:50:56 EDT 2016


On 04/18/2016 12:25 PM, Stephen J. Turnbull wrote:
> Koos Zevenhoven writes:

>> After all, we want something that's *almost* exclusively str.
>
> But we don't want that, AFAICT.  Some clearly want this API to be
> unbiased against bytes in the same way the os APIs are unbiased[2],
> because that's what we've got in the current proposal.

Are we reading the same thread?  For my last several replies I am very 
biased against bytes (and I know I'm not the only one).

Just not so biased that I'm unwilling to let clients say, "No, I'm 
really okay with getting bytes back".

I really like Koos' ideas because they allow the client to say:

- I only want str
- I only want bytes
- I'm okay with either

If the client says "I'm okay with either" then I fully expect the client 
to have code to properly handle str vs bytes after the fspath (or 
whatever it's called) call.

--
~Ethan~


More information about the Python-Dev mailing list