[Python-ideas] New PEP proposal -- Pathlib Module Should Contain All File Operations
Stephen J. Turnbull
turnbull.stephen.fw at u.tsukuba.ac.jp
Sat Mar 17 13:15:23 EDT 2018
George Fischhof writes:
> It seems that the original idea was something like for my idea.
> Just it not finished yet,
Antoine (author and maintainer of pathlib) is not the kind of
developer who leaves things unfinished. In PEP 428, there's a hint
that some shutil functionality could be added, but I really don't
think he meant anything as broad as in your PEP.
As far as I can recall, pathlib is intended from the beginning to
(1) represent paths in hierarchical local filesystems as Paths,
(2) manipulate individual Paths in various ways consistent with the
semantics of a hierarchal filesystem, and
(3) offer various ways to access the object denoted by a single Path.
Its functionality is very complete as far as that goes.
It does not contain methods to
(4) operate on directories as collections (with the exception of the
iterdir, glob, and rglob methods, which expose directory contents as
iterators of Paths),
(5) perform operations on several objects denoted by Paths at once
(copy and its multiple operand variants),
(6) perform process control or access process characteristics,
(7) perform operations (eg, mounting partitions and flow control on
TTYs) on devices (block or character), even if they can be
accessed via paths in some filesystem as in POSIX, or
(8) deal with users and other specialized OS objects.
I conclude there never was any intention to overlap with os or shutil,
except to the extent that they provide for any kind of path
manipulation. Rather, I suppose the intent was to provide a
substitute for os.path with a more convenient, complete,
object-oriented API and consistent semantics, based on more than a
decade of experience with os.path.
Regards,
Steve
More information about the Python-ideas
mailing list