Added a trivial unzip method, counterpart to zip
authorSverre Rabbelier <srabbelier@gmail.com>
Thu, 11 Dec 2008 20:53:57 +0000
changeset 719 2e635755713a
parent 718 5f9b1676816d
child 720 9eb2522dfa83
Added a trivial unzip method, counterpart to zip Patch by: Sverre Rabbelier
app/soc/logic/dicts.py
--- a/app/soc/logic/dicts.py	Thu Dec 11 04:23:42 2008 +0000
+++ b/app/soc/logic/dicts.py	Thu Dec 11 20:53:57 2008 +0000
@@ -89,6 +89,18 @@
 
   return result
 
+
+def unzip(target, order):
+  """Constructs a list from target in the order specified by order
+
+  Args:
+    target: the dictionary to pull the values from
+    order: the order of the keys
+  """
+
+  return (target[key] for key in order)
+
+
 def rename(target, keys):
   """Returns a dict containing only the key/value pairs from keys.