Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from functools import wraps
- class classonly:
- def __init__(self, func):
- self.func = func
- def __get__(self, obj, klass=None):
- if obj is not None:
- raise TypeError("This method cannot be called from a class instance.")
- @wraps(self.func)
- def wrapper(*args):
- return self.func(klass, *args)
- return wrapper
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement