Decorators 101: A Gentle Introduction to Functional Programming - Jillian Munson
"Functions are first-class objects in Python." This talk will discuss what we mean by first-class objects and how we can use this language feature to build more efficient, less redundant code with decorators without fear.
2. Defined a decorator (‘decorator’) 3. Write the decorator so that it returns a function definition (have ‘decorator’ return a locally defined function ‘inner_decorator’) 4. Tell the interpreter to pass a function to a decorator (‘@decorator’) and replace the original function with the function returned from our decorator.
some behavior that executes before and after our original function - Grab the parameters being passed to the decorated function and do something with them - Apply the same decorator to functions with different numbers of arguments