Top "Functools" questions

functools is a module for the Python language which provides support for working with higher-order functions: functions that act on or return other functions

What does functools.wraps do?

In a comment on this answer to another question, someone said that they weren't sure what functools.wraps was doing. …

python decorator functools
How does functools partial do what it does?

I am not able to get my head on how the partial works in functools. I have the following code …

python functional-programming partial-application functools
functools.partial on class method

I'm trying to define some class methods using another more generic class method as follows: class RGB(object): def __init__(…

python exception methods functools
itertools.accumulate() versus functools.reduce()

In Python 3.3, itertools.accumulate(), which normally repeatedly applies an addition operation to the supplied iterable, can now take a function …

python itertools python-3.3 functools
Python functools lru_cache with class methods: release object

How can I use functools' lru_cache inside classes without leaking memory? In the following minimal example the foo instance …

python caching python-decorators lru functools
Usage for lru cache in functools

I want to use lru_cache in my code, however, I get this error: NameError: name 'lru_cache' is not …

python lru functools
Use functools' @lru_cache without specifying maxsize parameter

The documentation for lru_cache gives the function definition: @functools.lru_cache(maxsize=128, typed=False) This says to me that …

python caching lru functools
Python3 pass lists to function with functools.lru_cache

I want to cache a function that takes a list as a parameter, but when I try to do so …

python python-3.x functools
python equivalent of functools 'partial' for a class / constructor

I want to create a class that behaves like collections.defaultdict, without having the usage code specify the factory. EG: …

python partial functools