In Python, some of the stated use cases, like extracting coverage, extracting the call graph, etc, you can get via tracing already (sys.settrace, <a href="https://docs.python.org/3/library/sys.html#sys.settrace" rel="nofollow">https://docs.python.org/3/library/sys.html#sys.settrace</a>).<p>And I would argue, the other stated use cases are maybe interesting to play around with, but nothing you really would want in production (I suppose).<p>Some of the other use cases, you can also achieve by module import hooks and rewriting the AST. (E.g. see how PyTest rewrites the assertion AST to produce nice error messages: <a href="https://github.com/pytest-dev/pytest/blob/main/src/_pytest/assertion/rewrite.py">https://github.com/pytest-dev/pytest/blob/main/src/_pytest/a...</a>)