Skip to content

Instantly share code, notes, and snippets.

@manuel-delverme
Last active April 9, 2019 11:38
Show Gist options
  • Save manuel-delverme/a18f6450978cc2086c1ad3be83c0ab90 to your computer and use it in GitHub Desktop.
Save manuel-delverme/a18f6450978cc2086c1ad3be83c0ab90 to your computer and use it in GitHub Desktop.
class CachedSomething:
def __init__(self):
self.cache = {}
def __setattr__(self, key, value):
self.cache[key] = value
def __getattr__(self, item):
return self.cache[item]
cs = CachedSomething()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment