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)