Is there a python module for identifying the source of a built in function?

34 views Asked by At

Is it possible to get the source of a built in function using something like the inspect module? Say, if I entered the value of print the return value would be something like "source = bltinmodule.c, builtin_print".

import inspect
import builtins

print_source = inspect.getsource(builtins.print)

print(print_source)

# TypeError: module, class, method, function, traceback, frame, or code object was expected, got builtin_function_or_method
0

There are 0 answers