Functools: functool.partial
Let's dig into the functool class i.e., partial.
We'll cover the following
About partial class
One of the functools classes is the partial
class. We can use it to create a new function with partial application of the arguments and keywords that we pass to it.
We can use partial
to “freeze” a portion of our function’s arguments and/or keywords which results in a new object.
Another way to put it is that partial
creates a new function
with some defaults.
Simple example of partial()
Let’s look at an example!
Get hands-on with 1400+ tech skills courses.