Advanced iteration

Master Python's most powerful tool

Unlock the full potential of Python by diving deep into the world of iteration.

In this hands-on, exercise-driven 4-day course, you'll learn how to wield generators, iterators, and the module itertools, to write code that is clearer, faster, and more expressive.

Whether you're building data pipelines, refactoring a legacy codebase, or developing a new project, this course is perfect for Python users with practical experience in any domain.

Course length and format

Course length: 4 days (32 hours)

Format: All courses offered have a similar format. The teaching is done without boring slides, but instead through live-coding (typically in a Jupyter notebook). During the exposition of new concepts or ideas, participants code along and solve small comprehension-check exercises. At the end of each section, participants are given multiple exercises to work through, to verify their understanding and to cement their learning.

Location: This course can be given remotely or on-site.

Course description

Python is a programming language that natively supports development in multiple paradigms. Developers frequently make use of the object-oriented features of Python, or even some of its functional capabilities, but all projects across all business domains leverage a fundamental concept from imperative programming: iteration.

Iteration in Python goes well beyond the C-style for loop. Knowing how to make an effective use of the tools that Python provides for flexible iteration is the basis for developing projects that are robust, idiomatic, and efficient.

In this course, participants will learn these tools and idioms required to use iteration appropriately, unlocking the ability to express complex business logic clearly, reduce code duplication, and write code that is both idiomatic and maintainable. Participants will explore generators and generator pipelines, custom iterators, the iterator protocol, the powerful utilities provided by the module itertools, and more.

By the end of the course, participants will not only understand how iteration works under the hood, but also how to design and refactor code with iteration in mind, making them more effective Python developers in any domain.

Course syllabus

  • List, dictionary, and set comprehensions.
  • Iterators vs iterables (built-in collections, collections from standard modules, enumerate, zip, and others).
  • Generator functions: definition and usage.
  • Simplification and abstraction of iteration details with generators.
  • Generator pipelines.
  • Generator expressions.
  • Custom iterables and iterators.
  • Iteration patterns and idioms with the module itertools from the standard library:
    • Reshaping iterables: batched, chain, groupby, and more.
    • Filtering iterables: compress, dropwhile, filterfalse, and takewhile.
    • Other iterables: accumulate, cycle, starmap, and more.
  • Type hints for generators, custom iterables, and custom iterators.

If you would like to tweak the course syllabus to your needs, reach out to me and we will work something out. For example, some teams ask me to omit the section on type hints since they do not use type hints in their projects.

Target audience

This course is aimed at developers with a working knowledge of Python: at least one year of professional Python experience is recommended. This course is suitable for Python users across all business domains and industries, given the general applicability of the concepts and techniques covered in this course.

Availability and pricing

Contact me for pricing and availability information.

About the instructor

Hi, I'm Rodrigo Girão Serrão from sunny Portugal 🇵🇹.

I'm a prolific Python author and speaker, with multiple books published independently and dozens of talks and tutorials given at the largest Python conferences in the world. I also blog frequently about Python and publish two Python newsletters: the mathspp insider and the daily Python drops 🐍💧.

I have extensive experience teaching people from all walks of life – from kids in school, to professionals in various industries, to retirees – and there is a clear consensus that my students enjoy my clear examples, the live-coding during my lessons, and most surprisingly: my quirky sense of humour.

Testimonials

Sofia Silva

What I take from my experience is that Rodrigo tries – and succeeds – in explaining concepts in the simplest way possible, which makes learning much easier. Additionally, he is interactive with the students and always available to provide exercises and any other information we may need. I really enjoyed my experience, and I am sure that many others will also have an excellent learning experience with Rodrigo.

Sofia Silva – Intro to Python course student

Guilherme Latrova

Rodrigo has a unique and very practical way of teaching, mixing different concepts and applying them with Python and this unique ability makes complex problems look easy by how Rodrigo approaches them.

Guilherme Latrova – Python speaker & blogger

Mike Driscoll

Rodrigo is a great teacher who excels at showing how different approaches to the same code work. Rodrigo is able to break down difficult problems into easy-to-digest pieces that will help you understand the problem AND the solution.

Mike Driscoll – Author of “Python 101” & other Python books

Will McGugan

Rodrigo is an excellent communicator of Python technical content. You can rely on him to thoroughly analyze code and algorithms, yet express his findings in a way that is digestible for beginner and experienced developers alike.

Will McGugan – Creator of rich & Textual

Schedule the course

Please contact me to schedule this course for your team.

Questions?

If you have any questions or inquiries regarding this course, please contact me and we'll sort everything out together.

Not what you're looking for?

Go back to see all training offerings or reach out to me if you want to discuss a custom training for your unique needs.