Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c7b5b3c

Browse files
committed
filecmp documentation from Moshe Zadka <[email protected]>.
1 parent 7eaf682 commit c7b5b3c

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

Doc/lib/libfilecmp.tex

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
\section{\module{filecmp} ---
2+
File Comparisons}
3+
4+
\declaremodule{standard}{filecmp}
5+
\sectionauthor{Moshe Zadka}{[email protected]}
6+
\modulesynopsis{Compare files efficiently.}
7+
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.
10+
11+
The \module{filecmp} module defines the following function:
12+
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.
16+
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()}.
21+
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
26+
cache.
27+
28+
Note that no external programs are called from this module giving it
29+
portability and efficiency.
30+
\end{funcdesc}
31+
32+
Example:
33+
34+
\begin{verbatim}
35+
>>> import filecmp
36+
>>> filecmp.cmp('libundoc.tex', 'libundoc.tex')
37+
1
38+
>>> filecmp.cmp('libundoc.tex', 'lib.tex')
39+
0
40+
\end{verbatim}

0 commit comments

Comments
 (0)