~/talk

Meta Generators: Playing Safe with Long Sequences

Talkat PyCon UK 2022 · 2022-09-16..09-18· at 12:00· Assembly Room· [python]
links:none on file
slides:none on file

Shows that using itertools functions like product can silently blow up memory because itertools.product materialises iterables so a 100-note combination step produces about 20 trillion combinations and forces buffering. Demonstrates practical use of range, combinations, chain and product, then builds meta-generators that add __iter__/copy/reversed to lazy iterables and a custom safe streaming product which preserves laziness and fixes the bug in real code, and it works for the reported use case.

AI-written summary · about

  1. 0:00Start
  2. 1:50What is a Generator?
  3. 3:49Benefits of Generators
  4. 5:30Music Matching
  5. 15:03Clone the Generator, Right?
  6. 16:32Pass the Generator Function
  7. 18:21Generator Pattern
  8. 19:13Copyable Meta Generator
  9. 20:47Reversible Meta Generator
  10. 22:08Are Iterator Functions Safe?
~/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.