1 \section{\module{filecmp
} ---
4 \declaremodule{standard
}{filecmp
}
5 \sectionauthor{Moshe Zadka
}{mzadka@geocities.com
}
6 \modulesynopsis{Compare files efficiently.
}
8 The
\module{filecmp
} module defines a function to compare files, taking all
9 sort of short-cuts to make it a highly efficient operation.
11 The
\module{filecmp
} module defines the following function:
13 \begin{funcdesc
}{cmp
}{f1, f2
\optional{, shallow
\optional{, use_statcache
}}}
14 Compare the files named
\var{f1
} and
\var{f2
}, returning
\code{1}
15 if they seem equal,
\code{0} otherwise.
17 Unless
\var{shallow
} is given and is false, files with identical
18 \function{os.stat()
} signatures are taken to be equal. If
19 \var{use_statcache
} is given and is true,
20 \function{statcache.stat()
} will be called rather then
\var{os.stat()
}.
22 Files that were compared using this function will not be compared again
23 unless their
\function{os.stat()
} signature changes. Note that using
24 \var{use_statcache
} true will cause the cache invalidation mechanism to
25 fail --- the stale stat value will be used from
\refmodule{statcache
}'s
28 Note that no external programs are called from this module giving it
29 portability and efficiency.
36 >>> filecmp.cmp('libundoc.tex', 'libundoc.tex')
38 >>> filecmp.cmp('libundoc.tex', 'lib.tex')