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.
Returning functions - Python Tutorial
From the course: Functional Programming with Python
Returning functions
- [Instructor] So far, we've seen that it's possible to define functions in pretty much the same way we define other data types, such as strings or numbers. And we've also seen that it's possible to pass functions as arguments. Again, similar to other data types. So the next logical thing for us to look at, with respect to first class functions, is our ability to return functions from other functions. Now, the usefulness of first class functions has been kind of limited until now without this final piece of our first class functions puzzle. This is the place where the flexibility that first class functions give us really starts to shine through. First, let's try to wrap our heads around the concept of functions that return functions. In programming, it's common to hear functions referred to as a black box. You put data into the box, and you get some data out. If we're talking about a function called double for…
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.