From the course: Functional Programming with Python
Unlock the full course today
Join today to access over 22,500 courses taught by industry experts or purchase this course individually.
Higher-order functions - Python Tutorial
From the course: Functional Programming with Python
Higher-order functions
- [Instructor] We spent quite a bit of time in previous videos talking about first-class functions in Python. We've seen how Python treats functions in much the same way as any other data type and how this allows us to do things like pass functions as arguments to other functions and return functions from other functions. And as it happens there's a term for functions that behave this way. Functions that either take other functions' arguments or return functions are called higher-order functions. And using them in our code can provide some pretty amazing flexibility and reusability. To demonstrate this fact we're going to look at some examples of higher-order functions and what they can do. So the first thing we're going to look at is the problem of checking arguments in Python. It happens quite often in programming that we want to make sure that some of our arguments meet a certain criteria. For example, we might want to…
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.