views:

35

answers:

1

Given something like this:

@my_decorator
my_function(some, args)

Is it possible for my_decorator to discover the file and line number my_function was called from?

Thanks

+3  A: 

traceback.extract_stack() will allow you to examine the current stack frame.

Ignacio Vazquez-Abrams