source: vendor/python/2.5/Doc/lib/libcmp.tex

Last change on this file was 3225, checked in by bird, 18 years ago

Python 2.5

File size: 1.0 KB
Line 
1\section{\module{cmp} ---
2 File comparisons}
3
4\declaremodule{standard}{cmp}
5\sectionauthor{Moshe Zadka}{moshez@zadka.site.co.il}
6\modulesynopsis{Compare files very efficiently.}
7
8\deprecated{1.6}{Use the \refmodule{filecmp} module instead.}
9
10The \module{cmp} module defines a function to compare files, taking all
11sort of short-cuts to make it a highly efficient operation.
12
13The \module{cmp} module defines the following function:
14
15\begin{funcdesc}{cmp}{f1, f2}
16Compare two files given as names. The following tricks are used to
17optimize the comparisons:
18
19\begin{itemize}
20 \item Files with identical type, size and mtime are assumed equal.
21 \item Files with different type or size are never equal.
22 \item The module only compares files it already compared if their
23 signature (type, size and mtime) changed.
24 \item No external programs are called.
25\end{itemize}
26\end{funcdesc}
27
28Example:
29
30\begin{verbatim}
31>>> import cmp
32>>> cmp.cmp('libundoc.tex', 'libundoc.tex')
331
34>>> cmp.cmp('libundoc.tex', 'lib.tex')
350
36\end{verbatim}
Note: See TracBrowser for help on using the repository browser.