Created
June 25, 2014 14:49
-
-
Save hirokiky/aea00272fff76c30e97d to your computer and use it in GitHub Desktop.
Answering for this question https://twitter.com/nyaocat/status/481791765498720256
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
_some_global_value = 'hoge' | |
class A(object): | |
def __del__(self): | |
global _some_global_value | |
_some_global_value = 'fuga' | |
class B(object): | |
def hoge(self): | |
return _some_global_value | |
assert B().hoge() == 'hoge' | |
a = A() | |
a = B() | |
assert a.hoge() == 'fuga' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment