Programmers are often looking to do more with less — but more reliable, and easier to debug — code. One programming methodology, known as "functional programming," tried to do this by treating data as immutable, avoiding variable assignments, and passing functions as arguments to other functions.
The good news is that when used properly, functional techniques allow you to accomplish a lot in very little, highly expressive code.
The bad news is that for many developers, functional techniques aren’t natural. Not modifying any values, and not keeping track of state, might be great ways to make your software more reliable, but it’s almost guaranteed to confuse and frustrate many developers.
Functional techniques are thus among the most difficult to comprehend in the programming world. And yet, their elegance and simplicity are hard to beat.
Python isn’t a functional language; we have mutable data types and assignment. But some functional techniques have made their way into the language, and are considered standard, "Pythonic" ways to solve some problems.
Specifically, Python offers "comprehensions," a modern take on classic functions that originated in the Lisp language. Comprehensions make it relatively easy to create lists, sets, and dicts based on other data structures. The fact that Python’s functions are objects, and can thus be passed as arguments or stored in data structures, also comes from the functional world.