Find all decorated functions in a module

python

Solution

In the general case it is not possible because the `example` decorator might not leave any trace that's detectable at runtime -- for example, it could be

def example(f):
  return f

If you do control the source for `example`, it's of course easy to make it mark or record the functions it's decorating; if you don't, it may be utterly impossible to do what you want.

Problem

Is it possible to find out if a function is decorated at runtime? For example could I find all functions in a module that are decorated by "example"? ``` @example def test1(): print "test1" ```

Original source

Related problems