Python Inspect Module
Object introspection — getsource, getfile, getmembers, signature. This category documents 15 Python inspect module entries, and each page gives you the full syntax, the parameter list, the return value, and a runnable example. The entries include: inspect.getsource(), inspect.getfile(), inspect.getmembers(), inspect.signature(), inspect.isfunction(), inspect.ismethod(), inspect.isclass(), inspect.ismodule(), inspect.getdoc(), inspect.getmodule(), inspect.getsourcefile(), inspect.getsourcelines(), inspect.getclasstree(), inspect.getargspec(), inspect.formatargspec(). inspect.getsource() returns the source code of a module, class, method, function, or code object. inspect.getfile() returns the file path where an object is defined. inspect.getmembers() returns all members of an object as (name, value) pairs, optionally filtered. inspect.signature() returns the Signature object for a callable (parameters, return annotation). inspect.isfunction() returns True if the object is a regular Python function. Inspect Module belongs to the Dev Tools group alongside Pdb Module, Traceback Module, Timeit Module, GC Module.