Skip to Content
Python For Loops and Iterables Deep Dive: Write Iterable Classes and Create Generator Functions and Expressions.
on-demand course

Python For Loops and Iterables Deep Dive: Write Iterable Classes and Create Generator Functions and Expressions.

with Coen de Groot
May 2024
Intermediate
29m
English
Apress
Closed Captioning available in English

Overview

This video aims to provide an understanding of Python’s for loop.

The video starts with the basics of a Python for-loop, including tips for programmers coming from other languages. It also discuss advanced for-loops, including how to change the flow of a loop using break (break out of a loop when done), continue (skip an item), and else statements (take an action when a loop was run through to completion). The next part provides insight into the machinery behind for-loops, including the distinction between an iterable and an iterator, and how Python knows when there are no more items to use in a for-loop. Additionally, the video will cover creating classes that can be used in a for-loop. The video will also discuss generator functions that provide a simpler way to create an iterable. Furthermore, the video will cover generator expressions, and compare them with list comprehensions.

By the end of the video, viewers will have an understanding of for-loops in Python, including both the basics and advanced techniques, along with an understanding of the underlying mechanics. The video will also provide viewers with a good foundation for writing iterable classes and creating generator functions and expressions.

What you will learn:
• What are Simple for-loops the Pythonic way
• How to write a class which can be used in a for-loop
• What are Iterable classes
• What are general functions and general expressions
Who this video is for:
This course is for new Python developers, or experienced developers coming from another
language, who want to use the optimal Python syntax. And for experienced Python developers
who want to take their use and understanding of iteration in Python to the next level.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Watch now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Python Functions Deep Dive Part 2: Write Simple and Parameterized Decorator

Python Functions Deep Dive Part 2: Write Simple and Parameterized Decorator

Coen de Groot

Publisher Resources

ISBN: 9798868801624