Created
March 21, 2016 11:06
-
-
Save elzibubble/de0fb5d70cf89928435c 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
import os | |
FOO = None | |
class Foo(object): | |
this = None | |
def __init__(self): | |
Foo.this = self | |
global FOO | |
FOO = self | |
print "self: %s" % self | |
print "this: %s" % Foo.this | |
print "FOO : %s" % FOO | |
def main(): | |
os.system('clear') | |
mod = __import__('vars') | |
klass = getattr(mod, 'Foo') | |
foo = klass() | |
print Foo.this | |
print FOO | |
print "-" * 20 | |
foo = Foo() | |
print Foo.this | |
print FOO | |
if __name__ == '__main__': | |
main() |
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
self: <vars.Foo object at 0x7fc5825dedd0> | |
this: <vars.Foo object at 0x7fc5825dedd0> | |
FOO : <vars.Foo object at 0x7fc5825dedd0> | |
None | |
None | |
-------------------- | |
self: <__main__.Foo object at 0x7fc580e91f10> | |
this: <__main__.Foo object at 0x7fc580e91f10> | |
FOO : <__main__.Foo object at 0x7fc580e91f10> | |
<__main__.Foo object at 0x7fc580e91f10> | |
<__main__.Foo object at 0x7fc580e91f10> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment