title: How can a function refer stably to itself?
body: <p>[The code in the original version was badly messed up.  Even after I fixed the code, several highly confusing typos remained in the post.  I believe I finally fixed all of them too.  Profuse apologies.]</p>
  
  <p>The two calls to <code>alias</code> below produce different outputs, because the object associated with the variable <code>my_own_id</code> changes between the two calls:</p>
  
  <pre><code>&gt;&gt;&gt; def my_own_id():
  ...     me = my_own_id
  ...     return id(me)
  ... 
  &gt;&gt;&gt; alias = my_own_id
  &gt;&gt;&gt; alias()
  4301701560
  &gt;&gt;&gt; my_own_id = None
  &gt;&gt;&gt; alias()
  4296513024
  </code></pre>
  
  <p>What can I assign to <code>me</code> in the definition of <code>my_own_id</code> so that its output remains invariant wrt subsequent re-definitions of the <code>my_own_id</code> variable?  (IOW, so that the internal <code>me</code> variable always refers to the same function object?)</p>
  
  <p>(I can get the current frame (with <code>inspect.currentframe()</code>), but it contains only a reference to the current code object, not to the current function.)</p>
  
  <p>P.S. The motivation for this question is only to know Python better.</p>