Dynamic assignment of methods in python class
<p>I want to create a bunch of methods in class <code>__init__</code> method dynamically. Havent had luck so far. </p>

<p>CODE:</p>

<pre><code>class Clas(object):
    def __init__(self):
        for i in ['hello', 'world', 'app']:
            def method():
                print i
            setattr(self, i, method)
</code></pre>

<p>Than I crate method and call method that is fitst in list.</p>

<pre><code>&gt;&gt; instance = Clas()

&gt;&gt; instance.hello()

'app'
</code></pre>

<p>I expect it to print <code>hello</code> not <code>app</code>. WHat is the problem? 
In addition, each of these dynamically assigned methods referred to the same function in memory, even if I do <code>copy.copy(method)</code></p>
