[Python-Dev] pathlib - current status of discussions
Chris Barker - NOAA Federal
chris.barker at noaa.gov
Tue Apr 12 01:14:29 EDT 2016
> with the
> rationale being the one someone mentioned regarding ease-of-use in
> Consider os.path.join:
Why in the world do the os.path functions need to work with Path
objects? ( and other conforming objects)
Thus all started with the goal of using Path objects in the stdlib,
but that's for opening files, etc. Path is an alternative to os.path
-- you don't need to use both.
And if you do have a byte path, you can stick with os.path....
I'm confused about what a bytes path IS -- is it encoded? Can you
assume it can be decoded ? It seems to me that the ONLY time you
should get a byte path is from a low level system call on a posix
system, and you may have no idea how it's encoded. So the ONLY thing
you should do with it is pass it along to another low level system
I can't see why we should support anything else with bytes objects.
> - the names would be fspath and __fspath__, since the result may be
> either a path name as text, or an encoded path name as bytes
You just used the phrase "path name as bytes" -- so why is
__pathname__ inappropriate if it might return bytes?
I like __pathname__ better because this entire effort is because we'
be decided itMs important to make the distinction between a "path" and
the text representation of said path.
More information about the Python-Dev