def map_field(field, func, dict_sequence):
 for item in dict_sequence:
  try:
   item[field] = func(item.get(field, None))
   (yield item)
  except ValueError:
   pass

def map_field ( field , func , dict_sequence ) : for item in dict_sequence : try : item [ field ] = func ( item . get ( field , None ) ) ( yield item ) except ValueError : pass
apply given function to value of given key in every dictionary in sequence and set the result as new value for that key .