[Python-ideas] New PEP proposal -- Pathlib Module Should Contain All File Operations

Serhiy Storchaka storchaka at gmail.com
Sun Mar 18 07:45:46 EDT 2018

17.03.18 19:15, Stephen J. Turnbull пише:
> 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.

I concur with Stephen. Let's not move a half of the stdlib that have any 
relations with files to the pathlib module.

More information about the Python-ideas mailing list