x = 0 def foo(): x = x + 1 print x UnboundLocalError: local variable 'x' referenced before assignment
var x = 0; var foo = function() { x = x + 1; console.log(x); }
x = [0] def foo(): x[0] = x[0] + 1 print x[0]
Python3's nonlocal allows explicit enabling of scheme-like behaviour.