Created
February 2, 2012 14:14
-
-
Save RichardLitt/1723649 to your computer and use it in GitHub Desktop.
Showing what global does
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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