# HG changeset patch # User Frederic Bastien # Date 1210194111 14400 # Node ID ff6b7bfb6cdca1748771d5c3fbf36124b5adaa2b # Parent fa752c55aa091f2bc02259f8c9e18d1b725d871a added function LookupList.append_lookuplist diff -r fa752c55aa09 -r ff6b7bfb6cdc lookup_list.py --- a/lookup_list.py Wed May 07 16:26:28 2008 -0400 +++ b/lookup_list.py Wed May 07 17:01:51 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