From the course: Functional Programming with Python
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Partial application and currying - Python Tutorial
From the course: Functional Programming with Python
Partial application and currying
- [Instructor] The first advanced concept, we're going to look at is called partial application. So what is partial application? Well in simple terms, partial application is one we take a function that has some number of arguments and we fix some of those arguments to a set value. We then return a function that has less arguments than the original. This function with fixed arguments can then be called from anywhere else in the code and it'll be as if we had called the original function with all of its arguments. Partial application is a very useful way to configure more general functions in the more specific ones. In particular, if there is a function that we use often in our code where one or more of the arguments that we call with is almost always the same, then this function is a good candidate for using partial application. So now that we know what partial application is, what does it look like in code? Well…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.