Function caching

from functools import lru_cache
@lru_cache(maxsize=1)
def func1(n):
import time
#some time consuming task
time.sleep(n)
return "harish"
if __name__=='__main__':
print(func1(3))
input("enter any key:")
print(func1(3))

Comments

Popular posts from this blog

Steps taken by a compiler to execute a C program

Tokens in C

Variables and Data Types in C