What exactly does the non-shallow filecmp.cmp do?

I am using Python 2.6.2. docs for the filecmp module say:

The filecmp module defines functions for comparing files and directories with various optional time / correct compilations.

and filecmp.cmp functions:

filecmp.cmp (f1, f2 [, shallow])

Compare the files with the names f1 and f2, returning True if they seem equal, False otherwise.

If the value is not fine and false, files with the same os.stat () signatures are considered equal.

What they do not do is to indicate what level of accuracy is obtained using shallow=False . So what does shallow=False do? How correct is this?

+4
source share
1 answer

A consultation of source filecmp.py shows that if shallow=False , filecmp.cmp performs an exact comparison of the contents by reading and comparing chunks of each file. It returns True only if two files have the same content.

+8
source

All Articles