| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,8 +22,11 @@ The :mod:`filecmp` module defines the following functions: | |||
| 22 | 22 | Compare the files named *f1* and *f2*, returning ``True`` if they seem equal, | |
| 23 | 23 | ``False`` otherwise. | |
| 24 | 24 | ||
| 25 | - If *shallow* is true, files with identical :func:`os.stat` signatures are | ||
| 26 | - taken to be equal. Otherwise, the contents of the files are compared. | ||
| 25 | + If *shallow* is true and the :func:`os.stat` signatures (file type, size, and | ||
| 26 | + modification time) of both files are identical, the files are taken to be | ||
| 27 | + equal. | ||
| 28 | + | ||
| 29 | + Otherwise, the files are treated as different if their sizes or contents differ. | ||
| 27 | 30 | ||
| 28 | 31 | Note that no external programs are called from this function, giving it | |
| 29 | 32 | portability and efficiency. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -36,8 +36,9 @@ def cmp(f1, f2, shallow=True): | |||
| 36 | 36 | ||
| 37 | 37 | f2 -- Second file name | |
| 38 | 38 | ||
| 39 | - shallow -- Just check stat signature (do not read the files). | ||
| 40 | - defaults to True. | ||
| 39 | + shallow -- treat files as identical if their stat signatures (type, size, | ||
| 40 | + mtime) are identical. Otherwise, files are considered different | ||
| 41 | + if their sizes or contents differ. [default: True] | ||
| 41 | 42 | ||
| 42 | 43 | Return value: | |
| 43 | 44 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,2 @@ | |||
| 1 | + Updated the docstring and docs of :func:`filecmp.cmp` to be more accurate | ||
| 2 | + and less confusing especially in respect to *shallow* arg. | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments