Functional Programming Toolkit: Maps, Filters, and More
Understand and apply Python's functional programming built-in functions such as map, filter, enumerate, zip, and sorted. Learn how these tools help write cleaner, more efficient code, especially leveraging Python 3's iterator-based returns for better performance.
While writing functional code will be your responsibility, Python also includes a number of tools for functional programming. These built-in functions cover the basics, and they should help you write better code:
map(function, iterable)
map(function, iterable) applies the function to each item in iterable and returns either a list in Python 2 or an iterable map object in Python 3:
filter(function or None, iterable)
filter(function or None, iterable) filters the items in iterable based on ...