New submission from Sebastian Linke <[email protected]>:
pathlib.Path() could wrap shutil.copy() with something like this:
def copy(self, target):
if not self.is_file():
# No support for directories here
raise ValueError("Path must point to a regular file")
# copy() appends filename when Path is copied to a directory
# see shutil.copy() docstring and source for details
target = shutil.copy(self, target)
return self.__class__(target)
----------
components: Library (Lib)
messages: 355616
nosy: seblin
priority: normal
severity: normal
status: open
title: Add copy() method to pathlib
type: enhancement
versions: Python 3.9
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue38627>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com