def _structs_eq(a, b, comparison_func):
assert isinstance(a, dict)
if not isinstance(b, dict):
return False
# TODO support multiple mappings from same field name.
dict_len = len(a)
if dict_len != len(b):
return False
for a, b in ((a, b), (b, a)):
key_iter = six.iterkeys(a)
while True:
try:
key = next(key_iter)
except StopIteration:
break
if not comparison_func(a[key], b[key]):
return False
return True
评论列表
文章目录