Iterators and generators
Understand how “for” loops work — and how to implement your own iterable objects
What you should know
Course Content
Course length
7 hours
Number of lessons
81
Training materials
Jupyter notebooks + PDFs
Coding exercises
15
About the Course
Python programmers use “for” loops all of the time. But how do these loops work? How is it that strings, lists, tuples, dicts, and files all work with loops, but give different values with each iteration? And how can we make our own classes iterable?
This course answers all of these questions, introducing Python’s “iterator protocol” and how you can use it to your benefit. First, we’ll look at how you can add iteration to your own classes. Then we’ll look at generators and generator functions, which allow us to create iterators using function syntax. The course ends with an introduction to generator comprehensions, which produce generators using code that’s similar to a list comprehension.
What you’ll learn
- Python’s iterator protocol
- How to make a class iterable
- What you can do with an iterable class
- Styles of iterable classes, and their trade-offs
- Generators and generator functions
- Generator comprehensions
Preview The Course
Instructor
As with all courses on LernerPython.com, this is taught by Reuven Lerner.
Pricing
100% Money Back Guarantee
I’m a one-person company dedicatedto improving your career via Python and related technologies. If you haven’t gotten value from any of my courses, then just tell me — and I’ll refund your money.
LernerPython
$40
per user / month
- Unlimited access to all Python, Git, Regexp courses
- Members-only forums
- Python office hours, private lectures
LernerPython + Data
$50
per user / month
- Everything in Lerner Python Level
- Unlimited access to NumPy, Pandas, and SQL courses
- Pandas office hours and private lectures
- Bamboo Weekly Subscription ($100 Annual Value)
LernerPython
$400
per user / year
- Unlimited access to all Python, Git, Regexp courses
- Members-only forums
- Python office hours, private lectures
LernerPython + Data
$500
per user / year
- Everything in Lerner Python Level
- Unlimited access to NumPy, Pandas, and SQL courses
- Pandas office hours and private lectures
- Bamboo Weekly Subscription ($100 Annual Value)