[Python-ideas] Better stdlib support for Path objects

random832 at fastmail.us random832 at fastmail.us
Tue Oct 7 15:25:47 CEST 2014


On Tue, Oct 7, 2014, at 09:20, Donald Stufft wrote:
> > On Oct 7, 2014, at 9:17 AM, Barry Warsaw <barry at python.org> wrote:
> > On Oct 07, 2014, at 07:54 PM, Nick Coghlan wrote:
> >> A single dispatch generic function as an adapter API would be another
> >> option, but would likely pose bootstrapping problems for the lowest level
> >> interfaces like os.path and the open builtin.
> > 
> > I wouldn't expect low level APIs like os.path and built-in open to accept Path
> > objects.  pathlib already covers most of those use cases, and whatever is
> > missing from there can probably be easily added.   It's higher level libraries
> > accepting Path objects that is more interesting I think.
> 
> TBH I find a path library that I can’t use anywhere I use paths to be
> rather neutered.

It makes about as much sense for os.open to accept a path as it would
for it to return a TextIOWrapper instead of an int. The same applies, in
reverse, to built-in open.


More information about the Python-ideas mailing list