Last active
December 29, 2019 03:50
-
-
Save nicksspirit/5641df58ea9e6c04655def0dcca3b82a to your computer and use it in GitHub Desktop.
Creating a decorators that belong to the class.
This file contains hidden or 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
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