title: Using global variables in python in a function
body: <pre><code>def foo():
      global a 
      a = 10
  </code></pre>
  
  <p>vs</p>
  
  <pre><code>a = 0
  def foo():
      a = 10
  </code></pre>
  
  <p>What is the use of declaring global in a function instead of declaring variables right at the top. It should be cleaner this way ?</p>