Introduction to functools
Understand how to use the functools module to enhance your Python functions. Learn to implement lru_cache for caching results, create partial functions, utilize singledispatch for function overloading, and use wraps for maintaining function metadata.
We'll cover the following...
We'll cover the following...
Python comes with a fun module called functools. The functions
inside functools are considered “higher-order” functions which can act
on or return other functions. In this chapter, we will be looking at the following portions of the functools package:
lru_cachepartialssingledispatchwraps