Possible to pass a function into a object's method as an argument, which can refer to that object?
<pre><code>def my_func():
    stuff
    return something

my_object.my_method(my_func)
</code></pre>

<p>I want my_func to be able to refer to <code>my_object</code>. Essentially like deferred <code>self</code>, which means "whatever object I am in, refer to that"</p>

<p>You want to make a <a href="http://code-maven.com/function-or-callback-in-python" rel="nofollow">callback</a>. </p>

<p>And <a href="http://stackoverflow.com/questions/4689984/implementing-a-callback-in-python-passing-a-callable-reference-to-the-current">here</a> is a usage of callback in a design pattern. </p>

python python-2.7 functional-programming self function-object