title: Declaring global variables with a function in python
body: <p>This piece of JavaScript code works well. My issue isn't with fixing the code itself, rather how I can mimic this in Python.</p>
  
  <pre><code>function setupSomeGlobals() {
      // Local variable that ends up within closure
      var num = 666;
      // Store some references to functions as global variables
      gAlertNumber = function() { alert(num); }
      gIncreaseNumber = function() { num++; }
      gSetNumber = function(x) { num = x; }
  }
  </code></pre>
  
  <p>When <code>setupSomeGlobals()</code> is called it declares new functions to be used globally. Could this be mimicked in python somehow? I can't figure out how. Python functions don't really seem to run like JavaScript ones, since anything global needs to be returned somehow.</p>