Learn Enough Python to Be Dangerous: Software Development, Flask Web Apps, and Beginning Data Science with Python
by Michael Hartl
Chapter 6
Functional Programming
Having learned how to define functions and apply them in a couple of different contexts, now we’re going to take our programming to the next level by learning the basics of functional programming, a style of programming that emphasizes—you guessed it—functions. As we’ll see, functional programming in Python frequently employs a powerful (and very Pythonic) class of techniques called comprehensions, which typically involve using functions to conveniently construct Python objects with particular elements. The most common comprehensions are list comprehensions and dictionary comprehensions, which make lists and dictionaries, respectively. We’ll also see an example of how to use generator comprehensions to replicate ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access