% operation returned both left and right side, but only the left side is really important.

This commit is contained in:
Dave Halter
2014-05-19 13:26:12 +02:00
parent a717981679
commit 77baabb93b
2 changed files with 14 additions and 0 deletions

View File

@@ -244,4 +244,8 @@ def _element_calculate(evaluator, left, operator, right):
elif operator == '-': elif operator == '-':
if _is_number(left) and _is_number(right): if _is_number(left) and _is_number(right):
return [create(evaluator, left.obj - right.obj)] return [create(evaluator, left.obj - right.obj)]
elif operator == '%':
# With strings and numbers the left type typically remains. Except for
# `int() % float()`.
return [left]
return [left, right] return [left, right]

View File

@@ -84,3 +84,13 @@ return_one(''.undefined_attribute)
@undefined_decorator @undefined_decorator
def func(): def func():
return 1 return 1
# -----------------
# operators
# -----------------
string = '%s %s' % (1, 2)
# Shouldn't raise an error, because `string` is really just a string, not an
# array or something.
string.upper