decorators

Going meta with python: manipulating ASTs to create an introspective decorator at runtime

Is python interpreted or compiled? Knowing the nuances of the answer will help us build meta code using AST manipulation at runtime. I'll show you how to construct a decorator that can introspect in the local variables without tracing tricks!

An introspective python decorator using stack frames and the inspect module

Here I will discuss how to use the inspect module and the sys.trace to introspect in a python method using a decorator. With that, we can create a lot cool things like mathematical validation for our arguments, a report generator or any other kind of introspection.