super().aa(a, b) 和 super(Test001, self).aa(a, b)默认是等价的
from app.libs.timeout.own_func_timeout import OwnFuncTimeout
class Test:
def aa(self, a, b):
while True:
print(a, b)
class Test001(Test):
def aa(self, a, b):
"""
功能:重写父类方法
特殊说明:
1、虽然说super().aa(a, b) 和 super(Test001, self).aa(a, b) 是等价的
2、但是在func_timeout方法内部,则必须使用super(Test001, self).aa(a, b),否则会报错!
"""
OwnFuncTimeout.func_timeout(2, lambda: super(Test001, self).aa(a, b))
Test001().aa(1, 2)