Lint

The most significant change was to replace a use of `exec` by `type()` for dynamic class creation; I think this makes it more readable. The diff gets considerably easier to read with the ignore whitespace (`-w`) flag.

All tests pass.