# HG changeset patch # User Paul Boddie # Date 1335304275 -7200 # Node ID 9749bccaeca97ce4e1842a3bf3bf4e594b5f9b06 # Parent e0758ff1d6954cab4fd1f44b95ffdd41d3346c51 Switched from lists to sets for holding object set values. diff -r e0758ff1d695 -r 9749bccaeca9 micropython/common.py --- a/micropython/common.py Tue Mar 27 23:30:19 2012 +0200 +++ b/micropython/common.py Tue Apr 24 23:51:15 2012 +0200 @@ -85,7 +85,7 @@ def add(self, obj): if not self.has_key(obj): - self[obj] = [] + self[obj] = set() # Dictionary and related methods. @@ -116,7 +116,7 @@ if hasattr(other, "items"): for key, value in other.items(): - self[key] = value + self.get(key, []) + self[key] = add_sets(value, self.get(key, [])) # Combining sequence-like objects involves just adding members. @@ -131,7 +131,7 @@ possible, and incorporating values present in only one of the sets. """ - return combine(self, other, ObjectSet(), operator.add) + return combine(self, other, ObjectSet(), add_sets) def deepen_mapping_dict(d): @@ -258,6 +258,9 @@ combined.add(i1.merge(i2)) return combined +def add_sets(s1, s2): + return set(list(s1) + list(s2)) + # Visitors and activities related to node annotations. class ASTVisitor(compiler.visitor.ASTVisitor): diff -r e0758ff1d695 -r 9749bccaeca9 micropython/data.py --- a/micropython/data.py Tue Mar 27 23:30:19 2012 +0200 +++ b/micropython/data.py Tue Apr 24 23:51:15 2012 +0200 @@ -567,7 +567,7 @@ values.add(attrname) if value is not None: - values[attrname].append(value) + values[attrname].add(value) return users[name] else: