Partial functions in Python

Have you ever used partial functions? It's an interesting functionality that can be found in the functools package.

It's pretty straightforward - you can take a function that takes multiple arguments and produces a new function that has one or more arguments already set, effectively tailoring your previous function to a specific need.

See below an example of it in action.

Image preview

Found it useful? Subscribe to my Analytics newsletter at