Slide 5
Slide 5 text
In the beginning,
there were enhanced generators
>>> def grep(look_for):
... while True:
... line = (yield)
... if look_for in line: print(line)
...
>>> search = grep('Python'); next(search) # Primed
>>> search.send('Hi, Ruby?')
>>> search.send('Hi, Vancouver Python Day!')
Hi, Vancouver Python Day!