title: How to declare python global list
body: <p>I'm having some problems declaring a list. It seems like I cannot delete all the elements in the list. At the <code>reset_a</code> printout, it display an empty list but after another around of checking the list in <code>myFunction</code>, the previous element is still in the list. How can I  declare a global list and use it all over others defined?</p>
  
  <pre><code>a = []
  
  def reset_a():
      global a
      del a[:]
      print a
  
  def myFunction():
       global a
       #check other stuffs........... then..
       print a
       if data not in a:
           a.append(data)
           time.sleep(5)
           reset_a()
  
  if __name__=='__main__':
       while True:
          myFunction()
  </code></pre>
  
  <p>Edited: I found a way to get it done.</p>
  
  <pre><code>global a
  a = []
  
  def reset_a():
      del a[:]
      print a
  
  def myFunction():
       #check other stuffs...........and get 'data' then..
       print a
       if data not in a:
           a.append(data)
           time.sleep(5)
           reset_a()
  
  if __name__=='__main__':
       while True:
          myFunction()
  </code></pre>