example2.py 文件源码

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

项目:python-cookbook-3rd 作者: tuanavu 项目源码 文件源码
def __init__(self, clsname, bases, clsdict):
        super().__init__(clsname, bases, clsdict)
        sup = super(self, self)
        for name, value in clsdict.items():
            if name.startswith('_') or not callable(value):
                continue
            # Get the previous definition (if any) and compare the signatures
            prev_dfn = getattr(sup,name,None)
            if prev_dfn:
                prev_sig = signature(prev_dfn)
                val_sig = signature(value)
                if prev_sig != val_sig:
                    logging.warning('Signature mismatch in %s. %s != %s',
                                value.__qualname__, str(prev_sig), str(val_sig))

# Example
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号