Mercurial > hg-stable
changeset 18846:860d36b763ae
dicthelpers: add docstrings for diff and join
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Fri, 29 Mar 2013 15:23:19 -0700 |
parents | c1f416e4bc80 |
children | 40c679748fa9 |
files | mercurial/dicthelpers.py |
diffstat | 1 files changed, 11 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/dicthelpers.py Mon Apr 01 13:46:32 2013 -0700 +++ b/mercurial/dicthelpers.py Fri Mar 29 15:23:19 2013 -0700 @@ -29,7 +29,18 @@ return res def diff(d1, d2, default=None): + '''Return all key-value pairs that are different between d1 and d2. + + This includes keys that are present in one dict but not the other, and + keys whose values are different. The return value is a dict with values + being pairs of values from d1 and d2 respectively, and missing values + represented as default.''' return _diffjoin(d1, d2, default, True) def join(d1, d2, default=None): + '''Return all key-value pairs from both d1 and d2. + + This is akin to an outer join in relational algebra. The return value is a + dict with values being pairs of values from d1 and d2 respectively, and + missing values represented as default.''' return _diffjoin(d1, d2, default, False)