Saturday, January 02, 2016

Workaday World


IT firms look for expertise in specific areas.  "The I/O loop as used in Tornado" is one example, and here's a landing page for the above YouTube that explains it.

Think "design pattern".  A Python generator is like a piston that fires through a next cycle when triggered, but is non-blocking in between.  The code above gets many generators going, each eager to take a next step, pending a green light from a socket monitor.

We call them co-routines when we start using send to make the yield statement two-way.  An object may keep spiraling through, interlaced, chronicling a pilgrim's progress through an oft paused journey.

In the co-routine pattern, a Task class drives a generator piston to keep firing it as soon as ready.  Each GET request to the server (relatively slow) is wrapped in a task.  Watch it again to see how the Future class queues up the work that needs doing.

My thanks to Jesse for sharing his expertise.