Reach out to me on Twitter @mathsppblog and subscribe to my newsletter to level up your Python knowledge!
This talk was presented at PyCon Sri Lanka 2022.
In this talk I show what idiomatic Python code looks like and illustrate how the subjective notion of “beautiful”, or “elegant” code, can make your code objectively better, regardless of your Python skill level.
We do that by visiting several vanilla Python features that people sometimes forget to learn, as they rush to importing all the shiny modules and frameworks they really want to use. In order to achieve this, we go through the learning journey of a hypothetical Pythonista that wanted to implement enumerate
from scratch. We will start with a first version written by them and then refactor it incrementally through the use of Pythonic idioms and patterns.
The talk will build around a series of articles available online (at https://mathspp.com/blog/pydonts), where I explore all the vanilla Python features that make Python one of the most interesting programming languages to learn.
There are no prerequisites for this talk, and both advanced users and beginners alike can benefit from it. After the talk, you will have a better understanding of several concepts such as iterables and (infinite!) lazy generators, and you will know how to use them effectively to get the job done.