partial is a function found in the functools module that allows you to create new functions with some of the arguments pre-filled or “frozen”.
from functools import partial
def original_function(a, b, c):
return a + b * c
partial_function = partial(original_function, a=10, c=2) # Freeze 'a' and 'c'
result = partial_function(b=5) # Only need to supply 'b' print(result) # Output: 20
- dunder methods