Skip to content

Commit

Permalink
Expression.division/power: require arithmetic expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
inducer committed Oct 21, 2024
1 parent 1f506d4 commit b11a8b0
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions pymbolic/primitives.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,19 +478,19 @@ def __rmul__(self, other: object) -> Product:
return Product((other, self))

def __truediv__(self, other: object) -> Quotient:
if not is_valid_operand(other):
if not is_arithmetic_expression(other):
return NotImplemented

return Quotient(self, other)

def __rtruediv__(self, other: object) -> Quotient:
if not is_valid_operand(other):
if not is_arithmetic_expression(other):
return NotImplemented

return Quotient(other, self)

def __floordiv__(self, other: object) -> FloorDiv:
if not is_valid_operand(other):
if not is_arithmetic_expression(other):
return NotImplemented

return FloorDiv(self, other)
Expand All @@ -502,25 +502,25 @@ def __rfloordiv__(self, other: object) -> FloorDiv:
return FloorDiv(other, self)

def __mod__(self, other: object) -> Remainder:
if not is_valid_operand(other):
if not is_arithmetic_expression(other):
return NotImplemented

return Remainder(self, other)

def __rmod__(self, other: object) -> Remainder:
if not is_valid_operand(other):
if not is_arithmetic_expression(other):
return NotImplemented

return Remainder(other, self)

def __pow__(self, other: object) -> Power:
if not is_valid_operand(other):
if not is_arithmetic_expression(other):
return NotImplemented

return Power(self, other)

def __rpow__(self, other: object) -> Power:
if not is_valid_operand(other):
if not is_arithmetic_expression(other):
return NotImplemented

return Power(other, self)
Expand Down

0 comments on commit b11a8b0

Please sign in to comment.