~/talk

"Snakes & Ladders: A Gentle Introduction to Generators and Iterators"

Talkat PyOhio 2024 · 2024-07-27..07-28· [python]
links:none on file
slides:none on file

Shows a working Snakes & Ladders implemented in Python that uses __iter__ and __next__ for the iterator protocol and yield and send for generators, with code and slides on GitHub. Demonstrates a 100-square board (10x10) built as a per-player generator so no external position tracking is needed, a generator that cycles player turns, and how a generator replaces building whole lists to stream values lazily. Notes iterator PEP 234 (Python 2.1) and generator PEP 255 (Python 2.2).

AI-written summary · about

  1. 0:00Introduction
  2. 1:29Iterators and generators
  3. 6:22Iterator protocol
  4. 12:40Custom iterators
  5. 18:01Generators' advantages
  6. 24:03Generators vs functions
  7. 25:47Snakes and Ladders game
  8. 27:11Q&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.