title: Aliased name of a Function in Python
body: <p>I want to find the name of the function as it was called ... i.e. the name of the variable that called the function. Using the basic recipes i.e. with <code>__name__</code>, <code>func_name</code>, or inspecting the basic stack does not work for me. For example</p>
  
  <pre><code>def somefunc():
      print "My name is: %s" % inspect.stack()[1][3]
  
  a = somefunc
  a()
  # would output: out: "My name is: somefunc"
  # whereas I want it to output: "My name is: a"
  </code></pre>
  
  <p>My gut says I can do this, but I can't figure it out. Any python guru's out there?</p>