How to change function name dynamically in python
<p>I want to change the function name according to result obtained from another function but the function definition remains same How can i do this i tried the following example but it didn't work</p>

<pre><code>def f(text):
   def x(text):
     return text+"example"
   name=x(text)
   def name(y):
     return y
   return name
p=f("hi ")
print p("hello")
print p.__name__
</code></pre>

<p><strong>OUTPUT</strong></p>

<pre><code>hello
name
</code></pre>

<p>But i want the function name <code>p.__name__</code> as "hi example" not name</p>
