sortedset.py 文件源码

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

项目:cb-defense-splunk-app 作者: carbonblack 项目源码 文件源码
def _make_cmp(self, set_op, doc):
        "Make comparator method."
        def comparer(self, that):
            "Compare method for sorted set and set-like object."
            # pylint: disable=protected-access
            if isinstance(that, SortedSet):
                return set_op(self._set, that._set)
            elif isinstance(that, Set):
                return set_op(self._set, that)
            else:
                return NotImplemented

        comparer.__name__ = '__{0}__'.format(set_op.__name__)
        doc_str = 'Return True if and only if Set is {0} `that`.'
        comparer.__doc__ = doc_str.format(doc)

        return comparer
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号