mirror of
https://github.com/python/cpython.git
synced 2025-09-13 12:17:24 +00:00
New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
This commit is contained in:
parent
668213d3b8
commit
64bc94e3ec
6 changed files with 390 additions and 0 deletions
34
Doc/lib/libcmp.tex
Normal file
34
Doc/lib/libcmp.tex
Normal file
|
@ -0,0 +1,34 @@
|
|||
\section{\module{cmp} ---
|
||||
File comparisons}
|
||||
|
||||
\declaremodule{standard}{cmp}
|
||||
\sectionauthor{Moshe Zadka}{mzadka@geocities.com}
|
||||
\modulesynopsis{Compare files very efficiently.}
|
||||
|
||||
The \module{cmp} module defines a function to compare files, taking all
|
||||
sort of short-cuts to make it a highly efficient operation.
|
||||
|
||||
The \module{cmp} module defines the following function:
|
||||
|
||||
\begin{funcdesc}{cmp}{f1, f2}
|
||||
Compare two files given as names. The following tricks are used to
|
||||
optimize the comparisons:
|
||||
|
||||
\begin{itemize}
|
||||
\item Files with identical type, size and mtime are assumed equal.
|
||||
\item Files with different type or size are never equal.
|
||||
\item The module only compares files it already compared if their
|
||||
signature (type, size and mtime) changed.
|
||||
\item No external programs are called.
|
||||
\end{itemize}
|
||||
\end{funcdesc}
|
||||
|
||||
Example:
|
||||
|
||||
\begin{verbatim}
|
||||
>>> import cmp
|
||||
>>> cmp.cmp('libundoc.tex', 'libundoc.tex')
|
||||
1
|
||||
>>> cmp.cmp('libundoc.tex', 'lib.tex')
|
||||
0
|
||||
\end{verbatim}
|
Loading…
Add table
Add a link
Reference in a new issue