title: How to remove item from locals()?
body: <p>I'm working on a script that requires manipulation of <code>locals()</code>, and I'm having trouble removing values from it.  I've tried <code>locals().pop(key)</code> and <code>del locals()[key]</code>, but neither works.</p>
  
  <p>As an example:</p>
  
  <pre><code>def locals_test():
      a, b = 1, 2
      locals().pop('a')
      del locals()['b']
      return locals()
  
  def dict_test():
      test = {'a':1, 'b':2}
      test.pop('a')
      del test['b']
      return test
  
  print(locals_test()) # --&gt; {'a':1, 'b':2}
  print(dict_test())   # --&gt; {}
  </code></pre>
  
  <p>I'm trying to replicate the behavior of <code>dict_test()</code> in <code>locals_test()</code>, but I've yet to find a solution.  Does anyone know how to solve this? </p>