
[英]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类型的变量) ...