![](/img/trans.png)
[英]How to "tell" the decorator function that the return type is the same as the wrapped function in Python?
我有一個裝飾器,其返回類型與包裝的 function 返回類型相同。 這是一個簡單的例子。 該代碼按原樣運行,但是,它不為 output 值res提供類型提示。 有沒有辦法指定my_decorator返回與包裝的 function foo相同的類型(例如,兩者都返回Foo類型的變量) ...