You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current doc says, "Copy the contents of the file named src to a file
named dst". Anybody used to the unix shell "cp" command would assume that
dst could be a directory, in which case the true destination is a file in
that directory with the same basename as src. Experimentation shows that
this is not true. A note something like the following would help:
Note: unlike the "cp" shell command, dst may not be a directory; it must
be a path to a file in that directory.
True, there's no place in the docs which actually says a directory is
valid for dst, but the name of the module is shutil, so it's reasonable
for people to assume that these act the same way as the corresponding unix
shell commands. It should be stated up front that this is not true, to
avoid confusion.
Reading closer, I see that copy() has the shell-like semantics I was
expecting copyfile() to have. Perhaps the right fix is to include a note in
the copyfile() docs saying, "dst must be a file path; see also copy() for a
version which allows dst to be a directory".
It might also make sense to move copy() to the top of the list, because it
is the one which has the most shell-like semantics.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: