The second is the inspect module that builds on that, allowing you to get the stack frames, inspect function signatures etc.
The third is trackbacks, which need the stack and themselves are introspectable.
The fourth is metaclasses (making dynamic classes at runtime).
These are heavily used in Python, and are optimisation barriers. For example PyPy (Python with a JIT) disables optimisations when “inspect” is imported or used anywhere in the call stack.