Using List Comprehensions and Generator Expressions For Data Processing


Follow to receive video recommendations   a   A

Creating one list out of another list is a very common thing to do in Python, so common that Python includes a special construct just for this purpose: list comprehensions. We'll get hands-on experience using list comprehensions, set comprehensions, and dictionary comprehensions during this tutorial. We'll also learn how and when we can slightly tweak our comprehensions to turn them into more performant generator expressions. We will learn some tricks for figuring out which of our "for" loops can be rewritten as comprehensions and which cannot. We will focus heavily on **code readability and code clarity** and we'll discuss when comprehensions help readability and when they hurt. All new skills will be acquired through practice. We'll work through many exercises both individually and as a group. All students will also receive a cheat sheet which can be used for guidance during future comprehension-writing journeys. A laptop with Python installed is required for this workshop.

Editors Note:

I would like to work with open source projects to create a branch of the tree with all of the best videos for your open source project. Please send me an email if you are interested.