Last active
December 17, 2015 19:09
-
-
Save att14/5658622 to your computer and use it in GitHub Desktop.
Creates a getter and a setter for any attr on an object.
This file contains hidden or 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 _property(attr): | |
| def __get(self): | |
| return getattr(self, attr) | |
| def __set(self, value): | |
| setattr(self, attr, value) | |
| return property(__get, __set) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment