No, without `global` it works and even this way: def f(): print(x) x = 4 f() Run
But, the following doesn’t work and you have indeed to specify `global` (quite different from Nim here as the “equivalent” would be `var x = 2 * x + 1` which compiles and does the right thing): x = 4 def f(): x = 2 * x + 1 Run Python rules have their own logic, but they are not easier to understand that Nim ones. And for sure they are quite different as the binding is done at run time whereas the Nim compiler has to know at compile time what a name is referring to.