Skip to content

Instantly share code, notes, and snippets.

@HarkonenBade HarkonenBade/test.py
Created Feb 23, 2018

Embed
What would you like to do?
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
You can’t perform that action at this time.