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

George Fischhof george at fischhof.hu
Sun Mar 18 07:13:28 EDT 2018


2018-03-18 5:41 GMT+01:00 Nathaniel Smith <njs at pobox.com>:

> On Sat, Mar 17, 2018 at 10:15 AM, Stephen J. Turnbull
> <turnbull.stephen.fw at u.tsukuba.ac.jp> wrote:
> > (5) perform operations on several objects denoted by Paths at once
> >     (copy and its multiple operand variants),
>
> Sure it does: Path.rename and Path.replace. I know why rename and copy
> have historically been in separate modules, but the distinction is
> pretty arcane and matters a lot more to implementers than it does to
> users.
>
> Similarly, it's hard to explain why we have Path.mkdir but not
> Path.makedirs -- and these have historically both lived in the 'os'
> module, so we can't blame it on Path being a mirror of os.path. It's
> also not obvious why we should have Path.rmdir, but not Path.rmtree.
>
> My understanding is that the point of Path is to be a convenient,
> pleasant-to-use mechanism for accessing common filesystem operations.
> And it does a pretty excellent job of that. But it seems obvious to me
> that it's still missing a number of fairly basic operations that
> people need all the time. I don't think the PEP is there yet, and we
> can quibble over the details -- just copying over all the historical
> decisions in shutil isn't obviously the right move (maybe it should be
> Path.mkdir(include_parents=True) and Path.unlink(recursive=True)
> instead of Path.makedirs and Path.rmtree?), but there's definitely
> room for improvement.
>
> -n
>
> --
> Nathaniel J. Smith -- https://vorpus.org
>


:-)
+ 1

George
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180318/1c598f80/attachment.html>


More information about the Python-ideas mailing list