ttypes.py 文件源码

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

项目:stig 作者: rndusr 项目源码 文件源码
def __cmp(self, op, other):
        if not isinstance(other, str):
            return NotImplemented

        # Do case-insensitive comparison?
        # Make copies to avoid infinite recursion.
        o = str(other)
        if o == o.lower():
            s = str(self.lower())
        else:
            s = str(self)

        if op in (operator.__eq__, operator.__ne__, operator.__contains__):
            return op(s, o)
        elif self.isdigit():
            return op(int(s), len(o))
        elif other.isdigit():
            return op(len(s), int(o))
        else:
            return op(s, o)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号