[Python-Dev] pathlib - current status of discussions

Chris Angelico rosuav at gmail.com
Tue Apr 12 11:25:15 EDT 2016

On Tue, Apr 12, 2016 at 7:58 AM, Ethan Furman <ethan at stoneleaf.us> wrote:
> Sticking points:
> ---------------
> Do we allow bytes to be returned from os.fspath()?  If yes, then do we allow
> bytes from __fspath__()?

I would say No and No, on the basis that it's *far* easier to widen
their scope in 3.7 than to narrow it. Once you declare that one or
both of these may return bytes, it becomes an annoying incompatibility
to change that (even if it *is* marked provisional), which almost
certainly means it won't happen. By restricting them both, we force
the issue: if you want bytes, you'll know about it.

I'd also prefer to stick to Unicode path names, for reasons I've
stated in other threads. Undecodable path byte streams can be handled
already, so what are we really gaining by allowing a Path-like object
to emit bytes? If it becomes a major issue for a lot of types, it
wouldn't be hard to add a helper function somewhere (or a mixin class
that provides a ready-to-go __fspath__, which might well be


More information about the Python-Dev mailing list