1

I'm having a similar problem to this one. This answers the question when you make your own decorator.

However, when you just import a decorator, what to do then?

Ideally it would looks something like this

import functools

@functools.wraps()
@functools.lru_cache()
def func(x):
    "This is a function"
    print('Do something')
mrPuzzle
  • 75
  • 5
  • A decorator is just a function like any other. A function decorator spits out an object, which typically behaves like the function that was passed to it. If it does not add a reference to the original function as an attribute somewhere on the output object, you're out of luck. Simple as that. You will need very advanced introspection to get to it. – Daniil Fajnberg Feb 23 '23 at 21:15

0 Answers0