- def wrapper(left, right):
- if not isinstance(left, LinExpr):
- if isinstance(left, numbers.Rational):
- left = Rational(left)
- else:
- raise TypeError('left must be a a rational number '
- 'or a linear expression')
- if not isinstance(right, LinExpr):
- if isinstance(right, numbers.Rational):
- right = Rational(right)
- else:
- raise TypeError('right must be a a rational number '
- 'or a linear expression')
- return func(left, right)
+ def wrapper(expression1, expression2, *expressions):
+ expressions = (expression1, expression2) + expressions
+ for expression in expressions:
+ if not isinstance(expression, LinExpr):
+ if isinstance(expression, numbers.Rational):
+ expression = Rational(expression)
+ else:
+ raise TypeError('arguments must be rational numbers '
+ 'or linear expressions')
+ return func(*expressions)