diff lookup_list.py @ 142:ad144fa72bf5

Automated merge with ssh://p-omega1@lgcm.iro.umontreal.ca/tlearn
author Frederic Bastien <bastienf@iro.umontreal.ca>
date Mon, 12 May 2008 14:15:16 -0400
parents 3f4e5c9bdc5e ff6b7bfb6cdc
children 4803cb76e26b
line wrap: on
line diff
--- a/lookup_list.py	Fri May 09 17:38:57 2008 -0400
+++ b/lookup_list.py	Mon May 12 14:15:16 2008 -0400
@@ -71,6 +71,12 @@
         self._values.append(value)
         self._names.append(key)
 
+    def append_lookuplist(self, *list):
+        for l in list:
+            for key in l.keys():
+                self.append_keyval(key,l[key])
+        del l
+
     def __len__(self):
         return len(self._values)
 
@@ -103,3 +109,15 @@
         Return a list of values associated with the given names (which must all be keys of the lookup list).
         """
         return [self[name] for name in names]
+
+
+if __name__ == '__main__':
+
+    a=LookupList(['a'],[1])
+    print a
+    b=LookupList(['b'],[2])
+    print b
+    a.append_lookuplist(b)
+    print a
+    a.append_lookuplist(b)
+    print a