Last active
October 19, 2016 05:05
-
-
Save brenttaylor/33abc56ac069c516a34470f8c2f69bc7 to your computer and use it in GitHub Desktop.
Total bastardry
This file contains 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
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