Last active
August 31, 2022 16:49
-
-
Save edsu/077a4e7089c4ef3ea7de92fd9819ba71 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
globals()['y'] = 1 |
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
# this works | |
globals()['x'] = 1 | |
print(x) | |
# this works too | |
import mymodule | |
print(mymodule.y) | |
# but this doesn't because y is global mymodule | |
print(y) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment