change "dict comprehension" to python2.6 compatibility
merge from danballan's PR