staticmethod: get the class name?
<p>Is there a way to find the name of the class a staticmethod belongs to?</p>

<pre><code>class A(object):
    @staticmethod
    def my_staticmethod():
        return 'static'

    @classmethod
    def my_classmethod():
        return 'classmethod'


In [2]: A.my_staticmethod
Out[2]: &lt;function utils.my_staticmethod&gt;

In [3]: A.my_classmethod
Out[3]: &lt;bound method type.my_classmethod of &lt;class 'utils.A'&gt;&gt;
In [4]: A.my_classmethod.im_self.__name__
Out[4]: 'A'
</code></pre>

<p>For a classmethod, I can get the name of the class via <code>A.my_classmethod.im_self.__name__</code> but I could not figure it out for a staticmethod.</p>

<p>Any idea?
Thanks.</p>

<hr>

<p>Well, actually here is what I am trying to do.
I am trying to make 2 functions to "serialize/deserialize" a function/classmethod/staticmethod.</p>

<p>That means, someone can pass a function into the serialize function and gets a string.</p>

<pre><code>a_string = serialize(A.my_classmethod)
</code></pre>

<p>This string can be stored in the DB for example..
Then, this string should be sufficient to resolve the function to be able to call it:</p>

<pre><code># later on...
f = deserialize(a_string)
# I can use my function
f(...)
</code></pre>

<p>I could make it work for a function or a classmethod but not for a staticmethod since I can't figure out the class it belongs to and use getattr...</p>
