Global: Difference between revisions

From Helpful
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
 
Line 6: Line 6:




In python, the {{inlinecode|global}} keyword lets you write to global scope (you can always read it)
In python, the {{inlinecode|global}} keyword lets you write to global scope (variables from the global scope are always visible in narrower scopes, but python assumes that assigning to a variable should be a local variable ''unless declared otherwise'')
 
 
 
 
 
 


nonlocal was added later for a similar reason.





Latest revision as of 12:21, 17 May 2024