Overview
Syllabus
Intro
The dumbest function in the world
Bytecode from our function
What about this function?
What's the difference?
Bytecodes
What's a generator?
How does a "for" loop work
What about with our generator?
Doing it manually
"next" and generators
fib
Generator example 2: read_n
next_vowel
So, when do we use generators?
"yield" as an expression
The "send" method
Walrus yield
How can I use coroutines?
Coroutine as "nanoservices"
Example: MD5
Coroutine example 1: MD5
Coroutine example 2: Weather
Coroutine example 2.1: Weather
Coroutine example 3
Ending early
Revisiting the weather
Megaservices
Refactoring our generator
"yield from" to the rescue!
What about asyncio?
Should you use coroutines?
Taught by
EuroPython Conference