diff --git a/Cargo.toml b/Cargo.toml index 33ff5091..c15cf949 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "chiquito" -version = "0.1.2023092400" +version = "0.1.2023101100" edition = "2021" license = "MIT OR Apache-2.0" authors = ["Leo Lara "] diff --git a/src/frontend/python/chiquito/expr.py b/src/frontend/python/chiquito/expr.py index 52f99364..22e11396 100644 --- a/src/frontend/python/chiquito/expr.py +++ b/src/frontend/python/chiquito/expr.py @@ -26,6 +26,7 @@ def __add__(self: Expr, rhs: ToExpr) -> Sum: return Sum([self, rhs]) def __radd__(self: Expr, lhs: ToExpr) -> Sum: + lhs = to_expr(lhs) return Expr.__add__(lhs, self) def __sub__(self: Expr, rhs: ToExpr) -> Sum: @@ -33,6 +34,7 @@ def __sub__(self: Expr, rhs: ToExpr) -> Sum: return Sum([self, Neg(rhs)]) def __rsub__(self: Expr, lhs: ToExpr) -> Sum: + lhs = to_expr(lhs) return Expr.__sub__(lhs, self) def __mul__(self: Expr, rhs: ToExpr) -> Mul: @@ -40,6 +42,7 @@ def __mul__(self: Expr, rhs: ToExpr) -> Mul: return Mul([self, rhs]) def __rmul__(self: Expr, lhs: ToExpr) -> Mul: + lhs = to_expr(lhs) return Expr.__mul__(lhs, self) def __pow__(self: Expr, rhs: int) -> Pow: