Skip to content

Instantly share code, notes, and snippets.

@bartolootrit
bartolootrit / decorator.py
Last active November 26, 2018 07:34
Python decorator for static functions and instance methods
# Author: aurzenligl (https://stackoverflow.com/users/7249587/aurzenligl)
# see https://stackoverflow.com/a/48836522/704244
from functools import wraps
def _declassify(fun, args):
if len(args):
met = getattr(args[0], fun.__name__, None)
if met:
wrap = getattr(met, '__func__', None)
if getattr(wrap, 'original', None) is fun: