-
-
Save smugen/4286845 to your computer and use it in GitHub Desktop.
Python import cache test
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
import b, c | |
print __name__, ":", c.msg | |
print __name__, ":", c is b.c | |
print __name__, ":", "reload c" | |
reload(c) | |
print __name__, ":", c.msg | |
print __name__, ":", c is b.c | |
print __name__, ":", b.c.msg |
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
print __name__, "enter" | |
import c | |
print __name__, ":", c.msg | |
c.msg = "I say B!" | |
print __name__, "exit" |
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
print __name__, "enter" | |
msg = "I am C." | |
print __name__, "exit" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
execute
output