Python Hooks
Revision as of 16:02, 20 July 2017 by PeterHarding (talk | contribs) (Created page with " =Hook Functions & Wrappers= <pre> import whatever import functools def prefix_function(function, prefunction): @functools.wraps(function) def run(*args, **kwargs):...")
Hook Functions & Wrappers
import whatever import functools def prefix_function(function, prefunction): @functools.wraps(function) def run(*args, **kwargs): prefunction(*args, **kwargs) return function(*args, **kwargs) return run def this_is_a_function(parameter): pass # Your own code here that will be run before whatever.this_is_a_function = prefix_function( whatever.this_is_a_function, this_is_a_function)