Index: Lib/inspect.py
===================================================================
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -172,6 +172,27 @@
__kwdefaults__ dict of keyword only parameters with defaults"""
return isinstance(object, types.FunctionType)
+def isanyfunction(object):
+ """
+ Return true if the object is any kind of function (method, builtin etc.).
+ """
+ return type(object) in types.AllFunctionTypes
+
+def isanyboundfunction(object):
+ """
+ Return true if the object is any kind of bound function.
+
+ Class methods are considered bound functions. Static methods are not.
+ """
+ return isanyfunction(object) and hasattr(object, '__self__') and \
+ self is not None and type(self) is not types.ModuleType
+
+def isanyunboundfunction(object):
+ """
+ Return true if the object is any kind of unbound function.
+ """
+ return isanyfunction(object) and not isanyboundfunction(object)
+
def isgeneratorfunction(object):
"""Return true if the object is a user-defined generator function.