title: How to find the name of the current function?
body: <p>I know it seems lame, but I'd like to have a function get access to its own name for printing error or debugging messages.  It would be easy then to have a standard way to start the printout:</p>
  
  <pre><code>print(__myname__,"is reporting the following..."
  </code></pre>
  
  <p>I prefer this to having to explicitly type the name each time because I often
  want to cut and paste such things, and I'd like any name change to be automatic, and thus more robustly correct.</p>
  
  <p>This is similar to <a href="https://stackoverflow.com/questions/2654113/how-to-get-the-callers-method-name-in-the-called-method">another question</a> but I want the name of the current function, not the name of its caller.</p>
  
  <p>I note that the special name </p>
  
  <pre><code>__name__
  </code></pre>
  
  <p>in this spot is reporting the name of the package, not the name of the function.</p>