title: Where is nonlocals()?
body: <p>How do I obtain the non-local variables for the current scope? The functions <code>vars</code>, <code>locals</code>, and <code>globals</code> exist, but is there a function to get the <code>nonlocals</code>?</p>
  
  <p>Why aren't the nonlocals listed when calling <code>vars</code>?</p>
  
  <h2>Update</h2>
  
  <p>My issue is that there's no way to enumerate the variables available in the current scope, as neither <code>vars</code> or <code>globals</code> includes the non-locals AFAICT.</p>
  
  <p>I frequently use <code>vars</code> in code such as the following:</p>
  
  <pre><code>'{meh[0]}/{meh[3]} {a}{b}{c}'.format(**vars())
  </code></pre>
  
  <p>Which fails if any of these variables are in the scope of a containing function.</p>