diff options
author | R David Murray <rdmurray@bitdance.com> | 2012-08-14 21:50:38 -0400 |
---|---|---|
committer | R David Murray <rdmurray@bitdance.com> | 2012-08-14 21:50:38 -0400 |
commit | becfcc0a6bbfa507049260b29d8ffc2f334dfcc0 (patch) | |
tree | 442d39c21794902a992a0da0d16e12d3c9cb5f2f | |
parent | 6ce21a3b848c75091412f08ceef43b314ac2c4c6 (diff) | |
download | cpython-git-becfcc0a6bbfa507049260b29d8ffc2f334dfcc0.tar.gz |
#15269: document dircmp.left and right.
Based on patch by Chris Jerdonek.
-rw-r--r-- | Doc/library/filecmp.rst | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Doc/library/filecmp.rst b/Doc/library/filecmp.rst index cc68319cf3..6881969c2a 100644 --- a/Doc/library/filecmp.rst +++ b/Doc/library/filecmp.rst @@ -106,6 +106,16 @@ The :class:`dircmp` class to compute are used. + .. attribute:: left + + The directory *a*. + + + .. attribute:: right + + The directory *b*. + + .. attribute:: left_list Files and subdirectories in *a*, filtered by *hide* and *ignore*. @@ -168,3 +178,18 @@ The :class:`dircmp` class A dictionary mapping names in :attr:`common_dirs` to :class:`dircmp` objects. + +Here is a simplified example of using the ``subdirs`` attribute to search +recursively through two directories to show common different files:: + + >>> from filecmp import dircmp + >>> def print_diff_files(dcmp): + ... for name in dcmp.diff_files: + ... print "diff_file %s found in %s and %s" % (name, dcmp.left, + ... dcmp.right) + ... for sub_dcmp in dcmp.subdirs.values(): + ... print_diff_files(sub_dcmp) + ... + >>> dcmp = dircmp('dir1', 'dir2') + >>> print_diff_files(dcmp) + |