[Python-Dev] pathlib - current status of discussions
cybersol at yahoo.com
Thu Apr 14 12:30:51 EDT 2016
Donald Stufft <donald <at> stufft.io> writes:
> > On Apr 14, 2016, at 11:59 AM, Michael Mysinger via Python-Dev <python-dev
<at> python.org> wrote:
> > 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.
> This is only the case if you have a singular RichPath object that can
represent both bytes and str (which is
> what DirEntry does, which I agree makes it harder… but that’s already the
case with DirEntry.path).
> However that’s not the case if you have a bRichPath and uRichPath.
And you might even be able to retain your sanity if you enforce any
particular class to be either bRichPath or uRichPath. But if you do that,
then that still leaves DirEntry out in the cold, likely converting to str in
its __fspath__. Which leaves me in the camp that bRichPath falls under YAGNI,
and RichPath should be str only.
More information about the Python-Dev