def is_regular_method(klass, attr, value=None):
"""Test if a value of a class is regular method.
example::
class MyClass(object):
def to_dict(self):
...
:param klass: the class
:param attr: attribute name
:param value: attribute value
"""
if value is None:
value = getattr(klass, attr)
assert getattr(klass, attr) == value
if inspect.isroutine(value):
if not is_static_method(klass, attr, value) and not is_class_method(klass, attr, value):
return True
return False
oo_method_inspect_utils.py 文件源码
python
阅读 28
收藏 0
点赞 0
评论 0
评论列表
文章目录