<?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=Static_Methods_in_Python</id>
	<title>Static Methods in Python - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://performiq.com/kb/index.php?action=history&amp;feed=atom&amp;title=Static_Methods_in_Python"/>
	<link rel="alternate" type="text/html" href="https://performiq.com/kb/index.php?title=Static_Methods_in_Python&amp;action=history"/>
	<updated>2026-05-18T23:54:13Z</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=Static_Methods_in_Python&amp;diff=3793&amp;oldid=prev</id>
		<title>PeterHarding: Created page with &quot; Hunting around found this example - http://code.activestate.com/recipes/52304-static-methods-aka-class-methods-in-python/  &lt;pre&gt; ## {{{ http://code.activestate.com/recipes/52...&quot;</title>
		<link rel="alternate" type="text/html" href="https://performiq.com/kb/index.php?title=Static_Methods_in_Python&amp;diff=3793&amp;oldid=prev"/>
		<updated>2012-02-23T06:14:12Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot; Hunting around found this example - http://code.activestate.com/recipes/52304-static-methods-aka-class-methods-in-python/  &amp;lt;pre&amp;gt; ## {{{ http://code.activestate.com/recipes/52...&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;
Hunting around found this example - http://code.activestate.com/recipes/52304-static-methods-aka-class-methods-in-python/&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
## {{{ http://code.activestate.com/recipes/52304/ (r3)&lt;br /&gt;
# direct, naive approach -- doesn&amp;#039;t work...:&lt;br /&gt;
class Class1:&lt;br /&gt;
    def static1(name):&lt;br /&gt;
        print &amp;quot;Hello&amp;quot;,name&lt;br /&gt;
&lt;br /&gt;
# ...but now, a call such as:&lt;br /&gt;
Class1.static1(&amp;quot;John&amp;quot;)&lt;br /&gt;
# will fail with a TypeError, as &amp;#039;static1&amp;#039; has become &lt;br /&gt;
# an unbound-method object, not a plain function.&lt;br /&gt;
&lt;br /&gt;
# This is easy to solve with a simple tiny wrapper:&lt;br /&gt;
class Callable:&lt;br /&gt;
    def __init__(self, anycallable):&lt;br /&gt;
        self.__call__ = anycallable&lt;br /&gt;
&lt;br /&gt;
# toy-example usage:&lt;br /&gt;
class Class2:&lt;br /&gt;
    def static2(name):&lt;br /&gt;
        print &amp;quot;Hi there&amp;quot;,name&lt;br /&gt;
    static2 = Callable(static2)&lt;br /&gt;
&lt;br /&gt;
# now, a call such as:&lt;br /&gt;
Class2.static2(&amp;quot;Peter&amp;quot;)&lt;br /&gt;
# works just fine, and as-expected&lt;br /&gt;
## end of http://code.activestate.com/recipes/52304/ }}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Python]]&lt;/div&gt;</summary>
		<author><name>PeterHarding</name></author>
	</entry>
</feed>