Skip to content

Instantly share code, notes, and snippets.

@brenttaylor
Last active October 19, 2016 05:05
Show Gist options
  • Save brenttaylor/33abc56ac069c516a34470f8c2f69bc7 to your computer and use it in GitHub Desktop.
Save brenttaylor/33abc56ac069c516a34470f8c2f69bc7 to your computer and use it in GitHub Desktop.
Total bastardry
class MetaModel(type):
def _get_count(self):
# just do db lookup here
return 5
count = property(_get_count)
class Model:
__metaclass__= MetaModel
print(Model.count)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment