Improve style of dict iteration.

Reviewed by @edyburn.