Created
February 23, 2018 14:41
-
-
Save HarkonenBade/27cf6a8080eef556a108f51493781504 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
class Foo: | |
@classmethod | |
def my_list(cls): | |
if hasattr(cls, 'mylist'): | |
return cls.mylist | |
cls.mylist = [] | |
return cls.mylist | |
class Bar(Foo): | |
pass | |
class Baz(Foo): | |
pass | |
a = Bar() | |
a.my_list().append(1) | |
b = Baz() | |
print(b.my_list()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment