Appearance
限制函数调用频率的装饰器
from usepy import throttle
delay
>>> import time >>> >>> @throttle(delay=2) ... def print_message(): ... print("函数被调用") >>> >>> print_message() 函数被调用 >>> print_message() # 立即调用,不会执行 >>> time.sleep(2) >>> print_message() 函数被调用
</rewritten_file>