<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://performiq.com/kb/index.php?action=history&amp;feed=atom&amp;title=Python_Hooks</id>
	<title>Python Hooks - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://performiq.com/kb/index.php?action=history&amp;feed=atom&amp;title=Python_Hooks"/>
	<link rel="alternate" type="text/html" href="https://performiq.com/kb/index.php?title=Python_Hooks&amp;action=history"/>
	<updated>2026-05-18T22:00:49Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.37.1</generator>
	<entry>
		<id>https://performiq.com/kb/index.php?title=Python_Hooks&amp;diff=4895&amp;oldid=prev</id>
		<title>PeterHarding: Created page with &quot; =Hook Functions &amp; Wrappers=  &lt;pre&gt; import whatever import functools  def prefix_function(function, prefunction):     @functools.wraps(function)     def run(*args, **kwargs):...&quot;</title>
		<link rel="alternate" type="text/html" href="https://performiq.com/kb/index.php?title=Python_Hooks&amp;diff=4895&amp;oldid=prev"/>
		<updated>2017-07-20T05:02:09Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot; =Hook Functions &amp;amp; Wrappers=  &amp;lt;pre&amp;gt; import whatever import functools  def prefix_function(function, prefunction):     @functools.wraps(function)     def run(*args, **kwargs):...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
=Hook Functions &amp;amp; Wrappers=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import whatever&lt;br /&gt;
import functools&lt;br /&gt;
&lt;br /&gt;
def prefix_function(function, prefunction):&lt;br /&gt;
    @functools.wraps(function)&lt;br /&gt;
    def run(*args, **kwargs):&lt;br /&gt;
        prefunction(*args, **kwargs)&lt;br /&gt;
        return function(*args, **kwargs)&lt;br /&gt;
    return run&lt;br /&gt;
&lt;br /&gt;
def this_is_a_function(parameter):&lt;br /&gt;
    pass # Your own code here that will be run before&lt;br /&gt;
&lt;br /&gt;
whatever.this_is_a_function = prefix_function(&lt;br /&gt;
    whatever.this_is_a_function, this_is_a_function)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* https://stackoverflow.com/questions/35758323/hook-python-module-function&lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
[[Category:Python]]&lt;br /&gt;
[[Category:Examples]]&lt;/div&gt;</summary>
		<author><name>PeterHarding</name></author>
	</entry>
</feed>