def __init__(self, op, *operands): typ = reduce(lambda a, b: xtyp(a, b) and a or None, operands) print "operands", operands print "found consensus type", typ and typ.type Has_Type.__init__(self, typ.type) self.operands = operands self.operator = op print "Operation:", str(self), Operation.__str__(self)
def __new__(cls, op, *operands): print "new Operation", op, operands typ = reduce(lambda a, b: xtyp(a, b) and a or None, operands) return typ is not None and Has_Type.__new__(cls) or None
def __init__(self, dest_type, expr): Has_Type.__init__(self, dest_type) self.expr = expr