Skip to main content

Reinventing the `itertools` wheel for fun and profit

Track:
Python Libraries & Tooling
Type:
Tutorial
Level:
intermediate
Room:
Club B
Start:
13:45 on 08 July 2024
Duration:
180 minutes

Abstract

In this hands-on tutorial we will reinvent the wheel!

We’ll reinvent the wheel and implement the module itertools in plain Python.

We’ll do that because it’s fun, but also because that will teach us a lot about Python:

  • the difference between iterables and iterators;
  • what the built-ins iter and next do;
  • how Python handles iterations and for loops under the hood;
  • what the iterator protocol is;
  • how the dunder methods __iter__ and __next__ play a part in all this; and
  • we’ll also learn about the functions inside itertools, a module with plenty of useful tools for your day-to-day iterations.

The speaker

Rodrigo Girão Serrão

Rodrigo Girão Serrão

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 https://mathspp.com/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.