Path-like objects in the standard library

Torsten Bronger bronger at physik.rwth-aachen.de
Fri Aug 24 04:42:27 EDT 2018


Hallöchen!

Path-like objects are accepted by all path-processing functions in
the standard library since Python 3.6.  Unfortunately, this is not
made explicit everywhere.  In particular, if I pass a Path in the
first argument of subprocess.run, do I use an implementation detail
of CPython?  Because on
https://docs.python.org/3.6/library/subprocess.html, only for the
cwd argument the acceptance of Paths is stated explicitly.

The same goes for all functions in the shutil module.
https://docs.python.org/3.6/library/shutil.html does not mention the
path-like protocol anywhere, but the CPython modules seem to accept
them anyway.

Regards,
Torsten.

-- 
Torsten Bronger



More information about the Python-list mailing list