Skip to content

Instantly share code, notes, and snippets.

@nicksspirit
Last active December 29, 2019 03:50
Show Gist options
  • Save nicksspirit/5641df58ea9e6c04655def0dcca3b82a to your computer and use it in GitHub Desktop.
Save nicksspirit/5641df58ea9e6c04655def0dcca3b82a to your computer and use it in GitHub Desktop.
Creating a decorators that belong to the class.
from functools import wraps
class _Decorator:
""" Class Decorators"""
@classmethod
def func(cls, arg):
def wrapper(fn):
@wraps(fn)
def wrap(self, *args, **kwargs):
return fn(self, *args, **kwargs)
return wrap
return wrapper
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment