app/soc/logic/dicts.py
changeset 1842 391b89d04bdd
parent 1749 a0ae6e6431a9
child 1899 c841800f3727
equal deleted inserted replaced
1841:d7ac10b583fb 1842:391b89d04bdd
   205   if not new_key:
   205   if not new_key:
   206     new_key = key
   206     new_key = key
   207 
   207 
   208   result = ((k, v[new_key]) for k, v in target.iteritems() if v[key])
   208   result = ((k, v[new_key]) for k, v in target.iteritems() if v[key])
   209   return dict(result)
   209   return dict(result)
       
   210 
       
   211 def identity(target):
       
   212   """Returns a dictionary with the values equal to the keys.
       
   213   """
       
   214 
       
   215   result = [(i, i) for i in target]
       
   216   return dict(result)