~/talk

Generators, Coroutines, and Nanoservices

Talkat PiterPy 2020 · 2020-08-03..08-06· [python]
links:none on file
slides:none on file

Explains how Python generator functions become in-process nanoservices using yield/send as a request/response protocol, with examples: an infinite fib generator, chunked file readers, a vowel scanner, an MD5 hashing service using hashlib, and a weather-forecast coroutine that fetches JSON from the WMO URL. Shows priming (next or decorator), the walrus operator for cleaner loops, delegation via yield from, throw/close semantics, and why this pattern works but can be hard to debug.

AI-written summary · about

  1. 0:00Introduction
  2. 1:10About the speaker
  3. 3:59Generators vs functions
  4. 6:04Iterator protocol
  5. 8:29Manual generator iteration
  6. 10:38Fibonacci generator
  7. 12:24Reading files in chunks
  8. 13:27Yielding vowels from a file
  9. 14:51Coroutines with send
  10. 18:24Walrus operator in coroutines
  11. 20:06Coroutines as nano services
  12. 21:10MD5 hash service
  13. 22:34Weather forecast service
  14. 24:18Database query engine
  15. 26:22Closing and throwing exceptions
  16. 27:24Combining services
  17. 29:31Yield from for coroutines
  18. 30:13Async IO and coroutines
  19. 30:56When to use coroutines
  20. 31:36Q&A
~/search
type to search 8,222 conferences, 162,397 speakers and 219,688 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
← →
on a talk: 5 seconds back / forward
0–9
on a talk: jump to 0%–90% of the recording
?
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.