Switch from dict comprehension to generator (for Python 2.6 support)