def __eq__(self, o): if isinstance(o, AST): return self.type == o.type and UserList.__eq__(self, o) else: # Don't forbid other types since we may try to compare AST with # Tokens. return self.type == o
def __init__(self, type, kids=[]): self.type = intern(str(type)) UserList.__init__(self, kids)