equivalence.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:ion-python 作者: amzn 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号