diff -r 9d24850db88f -r 2af7f84f4fc7 app/soc/logic/dicts.py --- a/app/soc/logic/dicts.py Thu Oct 23 05:21:26 2008 +0000 +++ b/app/soc/logic/dicts.py Thu Oct 23 05:21:41 2008 +0000 @@ -41,3 +41,28 @@ target[key] = value return target + +def zip(keys, values): + """Returns a dict containing keys with values + + If there are more items in keys than in values, None will be used. + If there are more items in values than in keys, they will be ignored. + + Args: + keys: the keys for the dictionary + values: the values for the dictionary + """ + + result = {} + + size = len(keys) + + for i in range(size): + if i < len(values): + value = values[i] + else: + value = None + key = keys[i] + result[key] = value + + return result