Code touch-ups

* Put (yield) in its own assignment expression. It's unfamiliar enough to be
  confusing, so don't make it worse by embedding it in complex function calls.
* Better line breaks for some comments.
* Use contextlib.closing() as a more idiomatic alternative to try / finally.

Change-Id: I3f08b3c148454f8fbbff0c006a0a12f47220b8e5