Skip to content

Instantly share code, notes, and snippets.

@att14
Last active December 17, 2015 19:09
Show Gist options
  • Select an option

  • Save att14/5658622 to your computer and use it in GitHub Desktop.

Select an option

Save att14/5658622 to your computer and use it in GitHub Desktop.
Creates a getter and a setter for any attr on an object.
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