3 ms·
The snippet is imprecise. it should be something like def hasmethod(obj, meth_name): """If it calls like a method it's a method."""
by brehaut 17y ago
The snippet is imprecise. it should be something like
def hasmethod(obj, meth_name):
"""If it calls like a method it's a method."""
return callable(getattr(obj, meth_name)) if hasattr(obj, meth_name) else False