Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
classproperty
class classproperty(property):
"""
Marries @property and @classmethod
Why doesn't python have this? Grr..
"""
def __new__(cls, fget, *args):
return super(classproperty, cls).__new__(cls, classmethod(fget), *args)
def __get__(self, obj, type=None):
return self.fget(type)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.