Last active
June 20, 2020 01:37
-
-
Save amaurs/e7ad7f8dbf6edd74fd990485b8ebcc0f to your computer and use it in GitHub Desktop.
exhibit a
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
class A: | |
some_value = {} | |
class B(A): | |
def modify_value(self): | |
self.some_value.update({"some_value": "b"}) | |
class C(A): | |
def modify_value(self): | |
self.some_value.update({"some_value": "c"}) | |
if __name__ == '__main__': | |
b = B() | |
c = C() | |
c.modify_value() | |
print(b.some_value) | |
b.modify_value() | |
print(b.some_value) | |
c.modify_value() | |
print(c.some_value) | |
# {'some_value': 'c'} | |
# {'some_value': 'b'} | |
# {'some_value': 'c'} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment