osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Path-like objects in the standard library


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