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

Ethan Furman ethan at stoneleaf.us
Thu Apr 14 12:46:13 EDT 2016


On 04/14/2016 08:59 AM, Michael Mysinger via Python-Dev wrote:

I am saying that if os.path.join now accepts RichPath objects, and those objects can return either str or bytes, then its much harder to reason about when I have all bytes or all strings. In essence, you will force me to pre- wrap all RichPath objects in either os.fsencode(os.fspath(path)) or os.fsdecode(os.fspath(path)), just so I can reason about the type. And if I have to always do that wrapping then os.path.join doesn't need to accept RichPath objects and call fspath at all.

What many folks seem to be missing is that you (generic you) have control of your data.

If you are not working at the bytes layer, you shouldn't be getting bytes objects because:

-- Ethan



More information about the Python-Dev mailing list