Last active
October 13, 2019 16:23
-
-
Save adrianmarkperea/4b1ed423e46598d993777b9999e221e8 to your computer and use it in GitHub Desktop.
This file contains 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
def foo(): | |
i_am_non_local = 5 | |
def bleep(): | |
i_am_non_local = 10 | |
def oof(): | |
nonlocal i_am_non_local | |
i_am_non_local = 20 | |
def bop(): | |
global i_am_non_local | |
i_am_non_local = 30 | |
bleep() | |
print('After bleep:', i_am_non_local) | |
oof() | |
print('After oof:', i_am_non_local) | |
bop() | |
print('After bop:', i_am_non_local | |
foo() | |
print('Globally:', i_am_non_local) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment