[Python-ideas] Re: Add copy to pathlib

2022-10-18 Thread Todd
On Tue, Oct 18, 2022, 19:39 Paul Bryan wrote: > For my edification, how is copy in pathlib proposed to be implemented? > Just call out to the OS to do the copy? Do the copy by reading and writing? > Just a thin wrapper around shutil.copy2 and shutil.copytree. Most non-parsing pathlib operations

[Python-ideas] Re: Add copy to pathlib

2022-10-18 Thread Wes Turner
pyfilemods is a generated reference of file/path modules and their methods. >From https://github.com/westurner/pyfilemods#copy (w/ all due respect to licenses) : Modules + - os - Source: https://github.com/python/cpython/tree/3.6/Lib/os.py - Docs: https://docs.python.org/3/library/os.

[Python-ideas] Re: Add copy to pathlib

2022-10-18 Thread Paul Bryan
For my edification, how is copy in pathlib proposed to be implemented? Just call out to the OS to do the copy? Do the copy by reading and writing? On Tue, 2022-10-18 at 19:24 -0400, Todd wrote: > On Tue, Oct 18, 2022 at 6:26 PM Chris Angelico > wrote: > > On Wed, 19 Oct 2022 at 09:17, Todd wrote

[Python-ideas] Re: Add copy to pathlib

2022-10-18 Thread Todd
On Tue, Oct 18, 2022 at 6:26 PM Chris Angelico wrote: > On Wed, 19 Oct 2022 at 09:17, Todd wrote: > > > > On Tue, Oct 18, 2022 at 5:00 PM Chris Angelico wrote: > >> > >> On Wed, 19 Oct 2022 at 06:50, Todd wrote: > >> > > >> > Currently, pathlib supports pretty much all common filesystem > oper

[Python-ideas] Re: Add copy to pathlib

2022-10-18 Thread Eryk Sun
On 10/18/22, Todd wrote: > > So I think it would make a lot of sense to include copying inside pathlib. > I propose adding a `copy` method to `pathlib.Path` (for concrete paths). > > The specific call signature would be: > > copy(dst, *, follow_symlinks=True, recursive=True, dir_exist_ok=True) > >

[Python-ideas] Re: Add copy to pathlib

2022-10-18 Thread Eryk Sun
On 10/18/22, Todd wrote: > > How is it any less of a "path operation" than moving files, reading and > writing files, making directories, and deleting files? Path-related operations involve creating, linking, symlinking, and listing directories and files, and peripherally also accessing file meta

[Python-ideas] Re: Add copy to pathlib

2022-10-18 Thread Chris Angelico
On Wed, 19 Oct 2022 at 09:17, Todd wrote: > > On Tue, Oct 18, 2022 at 5:00 PM Chris Angelico wrote: >> >> On Wed, 19 Oct 2022 at 06:50, Todd wrote: >> > >> > Currently, pathlib supports pretty much all common filesystem operations. >> > You can create, move, and delete both files and directorie

[Python-ideas] Re: Add copy to pathlib

2022-10-18 Thread Todd
On Tue, Oct 18, 2022 at 5:00 PM Chris Angelico wrote: > On Wed, 19 Oct 2022 at 06:50, Todd wrote: > > > > Currently, pathlib supports pretty much all common filesystem > operations. You can create, move, and delete both files and directories. > One big omission is copying. You need shutil for th

[Python-ideas] Re: Add copy to pathlib

2022-10-18 Thread Barry
> On 18 Oct 2022, at 21:59, Chris Angelico wrote: > > On Wed, 19 Oct 2022 at 06:50, Todd wrote: >> >> Currently, pathlib supports pretty much all common filesystem operations. >> You can create, move, and delete both files and directories. One big >> omission is copying. You need shutil fo

[Python-ideas] Re: Add copy to pathlib

2022-10-18 Thread Christopher Barker
> improve discoverability with a > docs reference. This is a great idea — I suggest a PR would be in order, and the good news is that a doc addition could be back-ported to all supported versions. However, I don’t agree that copy does not belong on pathlib. I get the point, but practically beat

[Python-ideas] Re: Add copy to pathlib

2022-10-18 Thread Chris Angelico
On Wed, 19 Oct 2022 at 06:50, Todd wrote: > > Currently, pathlib supports pretty much all common filesystem operations. You > can create, move, and delete both files and directories. One big omission is > copying. You need shutil for that. > > Whatever the original intent might have been behind

[Python-ideas] Add copy to pathlib

2022-10-18 Thread Todd
Currently, pathlib supports pretty much all common filesystem operations. You can create, move, and delete both files and directories. One big omission is copying. You need shutil for that. Whatever the original intent might have been behind pathlib, it is now effectively the standard tool for fil