Detect Decorator In Python
In python, is it possible to detect if there is a decorator on another function? Specifically, I'm trying (in django) to write some middleware that will detect if the view being pr
Solution 1:
Just some quick fooling around in the shell shows that the func_closure
attribute on a function is empty on undecorated functions, but contains data in decorated functions. Not 100% sure this is true all the time, but maybe this works out for you.
Post a Comment for "Detect Decorator In Python"