Example of animation with generator function. live page of euler 9 for use in China.
The generator function allows you to animate values created inside of for loops. It yields values to the draw loop and the draw loop, asks for next values. If the same thing were done in a normal function each frame would print the complete picture. This is good to animate algorithms or for displaying things that are computationally slow. I should really revisit the Mandelbrot set and use a generator function to build it up bit by bit.