util.py 文件源码

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

项目:pytypes 作者: Stewori 项目源码 文件源码
def is_classmethod(meth):
    """Detects if the given callable is a classmethod.
    """
    if inspect.ismethoddescriptor(meth):
        return isinstance(meth, classmethod)
    if not inspect.ismethod(meth):
        return False
    if not inspect.isclass(meth.__self__):
        return False
    if not hasattr(meth.__self__, meth.__name__):
        return False
    return meth == getattr(meth.__self__, meth.__name__)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号