Created
August 11, 2017 00:39
-
-
Save ellieayla/af4fa90486f8e5ddb7bff8d444407283 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env python | |
# https://www.reddit.com/r/Python/comments/6sx3xk/variable_being_treated_locally_when_should_be/ | |
from __future__ import print_function | |
def Ocean(fake_argument_to_keep_the_signature_the_same): | |
from os import path # line 2 | |
global path # line 6 | |
path.ADDITIONAL = "ATTRIBUTE" | |
print("Ocean", path.ADDITIONAL) | |
def Second(): | |
print("Second", path.ADDITIONAL) | |
if __name__ == "__main__": | |
Ocean(1) | |
print("__main__", path.ADDITIONAL) | |
Second() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment