Created
May 18, 2017 14:02
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
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