[docs] filecmp.cmp "shallow" documentation
Jeff Kaufman
jeff at jefftk.com
Mon Dec 15 21:17:39 CET 2014
If you have two files with identical size, mode, and mtime,
filecmp.cmp will return them as equal with its "shallow" option, which
is on by default. This is documented in 2.x as:
Unless shallow is given and is false, files with identical os.stat()
signatures are taken to be equal.
and in 3.x as:
If shallow is true, files with identical os.stat() signatures are taken
to be equal. Otherwise, the contents of the files are compared.
This doesn't explain what is included in the signature. On initial
reading, I had thought it would do something like "os.stat(a) ==
os.stat(b)", but it instead pulls out just the size, mode, and mtime
for comparison. Could we document this? Perhaps:
- ... files with identical os.stat() signatures are ...
+ ... files with identical size, mode, and mtime given by os.stat() are ..."
(This bit me with https://github.com/jeffkaufman/icdiff/issues/37
where I had thought inode number would be included in the stat
signature.)
More information about the docs
mailing list