mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
GH-73991: Rework pathlib.Path.copytree()
into copy()
(#122369)
Rename `pathlib.Path.copy()` to `_copy_file()` (i.e. make it private.) Rename `pathlib.Path.copytree()` to `copy()`, and add support for copying non-directories. This simplifies the interface for users, and nicely complements the upcoming `move()` and `delete()` methods (which will also accept any type of file.) Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
This commit is contained in:
parent
ea70439bd2
commit
a6644d4464
10 changed files with 141 additions and 197 deletions
|
@ -146,10 +146,8 @@ pathlib
|
|||
|
||||
* Add methods to :class:`pathlib.Path` to recursively copy or remove files:
|
||||
|
||||
* :meth:`~pathlib.Path.copy` copies the content of one file to another, like
|
||||
:func:`shutil.copyfile`.
|
||||
* :meth:`~pathlib.Path.copytree` copies one directory tree to another, like
|
||||
:func:`shutil.copytree`.
|
||||
* :meth:`~pathlib.Path.copy` copies a file or directory tree to a given
|
||||
destination.
|
||||
* :meth:`~pathlib.Path.delete` removes a file or directory tree.
|
||||
|
||||
(Contributed by Barney Gale in :gh:`73991`.)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue