Skip to content

Instantly share code, notes, and snippets.

@wheaties
Created October 25, 2018 01:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wheaties/70e73fcbd013ffa524bc5f068a76290a to your computer and use it in GitHub Desktop.
Save wheaties/70e73fcbd013ffa524bc5f068a76290a to your computer and use it in GitHub Desktop.
Partially Persistent Data
class Field:
def __get__(self, obj, obj_type=None):
if not obj:
return self
return getattr(obj.view(), self.__name__)
def __set__(self, obj, value):
obj.update(self.__name__=value)
def __set_name__(self, name):
self.__name__ = name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment