[Python-Dev] pathlib - current status of discussions
Ethan Furman
ethan at stoneleaf.us
Thu Apr 14 10:47:20 EDT 2016
On 04/14/2016 12:03 AM, Michael Mysinger via Python-Dev wrote:
> Brett Cannon writes:
> After playing with and considering the 4 possibilities, anything where
> __fspath__ can return bytes seems like insanity that flies in the face of
> everything Python 3 is trying to accomplish. In particular, one RichPath
> class might return bytes and another str, or even worse the same class might
> sometimes return bytes and sometimes str. When will os.path.join blow up due
> to mixing bytes and str and when will it work in those situations?
What are you asking here? Exactly where in os.join mixing bytes & str
the exception will occur, or will mixing bytes & str ever work?
The answer to the first is irrelevant (except for performance).
The answer to the second is always/never. Meaning allowing os.fspath()
and __fspath__ to return either bytes or str will never cause the
combination of bytes and str to work. Said another way: if you are
using os.path.join then all the pieces have be str or all the pieces
have to be bytes.
--
~Ethan~
More information about the Python-Dev
mailing list