Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

lru_cache

from functools import lru_cache


# store a maximum of 32 value cached
@lru_cache(maxsize=32)
def fib(n):
    if n < 2:
        return n
    return fib(n-1) + fib(n-2)

#clear cache
fib.cache_clear()
Comment

lru_cache

from functools import lru_cache

@lru_cache
def some_func(a):
	pass
Comment

PREVIOUS NEXT
Code Example
Python :: join list of string into a single string with comma 
Python :: tkinter video 
Python :: whitelist the ip address django 
Python :: pandas set one column equal to another 
Python :: ** in python 
Python :: dumps function in json python 
Python :: every second value python 
Python :: customise the django rest api view 
Python :: np array size 
Python :: accessing a variable from outside the function in python 
Python :: how to open annaconda 
Python :: collections.defaultdict(set) 
Python :: python datetime to unix timestamp 
Python :: automl classification tutorial sklearn 
Python :: python for loop range 
Python :: Python NumPy insert Function Syntax 
Python :: how to add hyperlink in jupyter notebook 
Python :: micropython wifi 
Python :: protected vs private python 
Python :: what does enumerate do in python 
Python :: invalid syntax python else 
Python :: how to make simple login in python 
Python :: append and extend in python 
Python :: FileSystemStorage django 
Python :: python class example 
Python :: python generators 
Python :: how to add values in python 
Python :: fix the debug_mode = false django 
Python :: closures in python 
Python :: python regex true false 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =