09-09, 17:00–19:00 (Europe/Lisbon), Workshop II
Practice how to write elegant comprehensions to make your code more idiomatic and easier to follow. With dozens of exercises, this tutorial will be perfect for you to finally get to grips with:
• list comprehensions;
• dictionary comprehensions;
• set comprehensions; and
• generator expressions.
Among other things, you will learn to identify situations where you should be using these powerful and elegant Python constructs. You will also learn how to use them to level up your Python skills.
By the end of the tutorial, you will learn all of the ins and outs of comprehensions, their use cases, best practices and things to avoid, and some advanced usage patterns as well!
The tutorial will start by presenting the simple anatomy of a list comprehension with a single looping construct and a single (optional) filter. We will motivate this anatomy from the point of view of a data transformation, which is an analogy that is well-received by audiences of all technical backgrounds and levels.
Then, we will move on to solving exercises about common usage patterns, and then we will extend the idea of a list comprehension to set/dict comprehensions and generator expressions.
Finally, we will deconstruct more advanced use cases, so that participants gain a clear understanding of all types of comprehensions.
Rodrigo has always been fascinated by problem solving and that is why he picked up programming – so that he could solve more problems. He also loves sharing knowledge, and that is why he spends so much time writing articles in his blog mathspp.com/blog, writing on Twitter @mathsppblog, and giving workshops and courses. You can also find his past talks on github.com/mathspp/talks.
His main areas of scientific interest are mathematics (numerical analysis in particular) and programming in general (with a preference for the Python and APL languages), but Rodrigo also enjoys reading fantasy books, watching silly comedy movies and eating chocolate.