title: The correct way to delete a variable if it exists
body: <p>I try doing:</p>
  
  <pre><code>def create_l():
      if 'l' in globals():
          l.destroy()
      l = Listbox(root)
  </code></pre>
  
  <p>This works fine but it returns a syntax warning:</p>
  
  <pre><code>Warning (from warnings module):
    File "C:\Users\User\Desktop\l.py", line 4
      l = Listbox(root)
  SyntaxWarning: name 'l' is used prior to global declaration
  </code></pre>
  
  <p>I am just wondering if there is a way to do this without the syntax warning.</p>