~/talk

Iterables and Iterators: Going Loopy With Python

Talkat PyData London 2016 · 2016-05-06..05-08· [python, developer-experience]
links:none on file
slides:none on file

Covers Python 2.2→3 iteration protocol with concrete code: getitem fallback vs __iter__/__next__, live IPython notebook and GitHub repo show a Stars class, a character-repeat iterator and generator-based iterable, plus nested-loop demos that reveal exhausted-iterator pitfalls. Demonstrates how generator functions return iterators, how iterables produce new iterators each call, and examples of mutating an underlying container during iteration. Runs ~25 minutes and the code executes as shown.

AI-written summary · about

  1. 0:00Introduction
  2. 4:05What is iteration
  3. 8:42Old vs new protocols
  4. 11:15Iterables vs iterators
  5. 15:54Nested loop pitfalls
  6. 20:15Key differences
  7. 24:16Custom iterators
  8. 27:25Generators and generator functions
  9. 31:22Generator methods
  10. 34:33Strings as iterables
  11. 35:14Summary & Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.