mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
bpo-42958: Improve description of shallow= in filecmp.cmp docs (GH-27166)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Alexander Vandenbulcke <alexander.vandenbulcke95@gmail.com>
(cherry picked from commit a8dc4893d2)
Co-authored-by: andrei kulakov <andrei.avk@gmail.com>
This commit is contained in:
parent
98f6a72ff6
commit
c2593b4d06
3 changed files with 10 additions and 4 deletions
|
|
@ -22,8 +22,11 @@ The :mod:`filecmp` module defines the following functions:
|
||||||
Compare the files named *f1* and *f2*, returning ``True`` if they seem equal,
|
Compare the files named *f1* and *f2*, returning ``True`` if they seem equal,
|
||||||
``False`` otherwise.
|
``False`` otherwise.
|
||||||
|
|
||||||
If *shallow* is true, files with identical :func:`os.stat` signatures are
|
If *shallow* is true and the :func:`os.stat` signatures (file type, size, and
|
||||||
taken to be equal. Otherwise, the contents of the files are compared.
|
modification time) of both files are identical, the files are taken to be
|
||||||
|
equal.
|
||||||
|
|
||||||
|
Otherwise, the files are treated as different if their sizes or contents differ.
|
||||||
|
|
||||||
Note that no external programs are called from this function, giving it
|
Note that no external programs are called from this function, giving it
|
||||||
portability and efficiency.
|
portability and efficiency.
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,9 @@ def cmp(f1, f2, shallow=True):
|
||||||
|
|
||||||
f2 -- Second file name
|
f2 -- Second file name
|
||||||
|
|
||||||
shallow -- Just check stat signature (do not read the files).
|
shallow -- treat files as identical if their stat signatures (type, size,
|
||||||
defaults to True.
|
mtime) are identical. Otherwise, files are considered different
|
||||||
|
if their sizes or contents differ. [default: True]
|
||||||
|
|
||||||
Return value:
|
Return value:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
Updated the docstring and docs of :func:`filecmp.cmp` to be more accurate
|
||||||
|
and less confusing especially in respect to *shallow* arg.
|
||||||
Loading…
Add table
Add a link
Reference in a new issue