First-Class Functions
Functions and nested-functions in Python.
We'll cover the following
Function: A first-class object
A first-class object is an object that can be:
- Created at runtime (assigned to a variable)
- Stored in a data structure
- Passed as an argument to another function
- Returned as a value from another function
Several data types in Python are first-class objects, e.g. int
, string
, etc. But that’s not it. Functions in Python are also first-class objects. Without any further ado, let us run a program demonstrating the nature of functions as first-class objects.
Create a free account to view this lesson.
By signing up, you agree to Educative's Terms of Service and Privacy Policy