all Python 3inspectfunction
inspect.isbuiltin()
object kind checks
Checks that an object is a built-in C function (len, math.sqrt) or a bound method of a built-in type ([].append).
Syntax
inspect.isbuiltin(object) -> bool
'Built-in' here means 'written in C', not 'from the standard library': json.dumps is written in Python, so isbuiltin gives False. An unbound method of a built-in type (list.append) is a method descriptor, not a builtin, and neither are built-in classes like int and list. It is handy for picking functions of a C module: getmembers(math, inspect.isbuiltin).
Examples
import inspect, json
print(inspect.isbuiltin(len), inspect.isbuiltin([].append)) # → True True
print(inspect.isbuiltin(list.append), inspect.isbuiltin(json.dumps)) # → False False
print(inspect.isbuiltin(int)) # → False — это класс
See also
Open in the full glossarydocs.python.orgReport an inaccuracy