Skip to content

Instantly share code, notes, and snippets.

@RichardLitt
Created February 2, 2012 14:14
Show Gist options
  • Select an option

  • Save RichardLitt/1723649 to your computer and use it in GitHub Desktop.

Select an option

Save RichardLitt/1723649 to your computer and use it in GitHub Desktop.
Showing what global does
x = 10
y = 30
def change(x):
x = 11
return x
print change(x), x
def change_global():
global y
y = 12
return y
print change_global(), y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment