def __str__ (self):
if (self.type() == int):
return "([Const:int] " + str(self.value()) + ")"
elif (self.type() == Fraction):
return "([Const:Fraction] " + str(float(self.value())) + ")"
else:
sys.exit("ERROR: invalid type of ConstantExpr found in __str__")
评论列表
文章目录