Skip to content

Instantly share code, notes, and snippets.

Created May 18, 2017 14:02
def get_field(self):
return self.__data
def set_field(self, val):
self.__data = val
def Field():
return property(get_field, set_field)
class A(object):
name = Field()
a = A()
b = A()
a.name = 1
b.name = 2
print(a.name) # 1
print(b.name) # 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment