Skip to content

Commit 5448ee0

Browse files
Fixed '__add__'-Function. Attempt #3
1 parent fe14fa4 commit 5448ee0

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

microps/wrappers/wrapper.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@ def __init__(self, v, engine):
3131
def __add__(self, o):
3232
left = self._val
3333
right = unwrap(o)
34-
# If either operand is a string, concatenate as strings (JS-like)
34+
# If either operand is a string, concatenate as strings (JS-like)
3535
if isinstance(left, str) or isinstance(right, str):
36-
return self.__class__(str(left) + str(right), self._engine)
36+
result = str(left) + str(right)
37+
return self.__class__(result, self._engine)
3738
# Attempt to convert to float otherwise
3839
for idx, val in enumerate([left, right]):
3940
if isinstance(val, str):
@@ -74,7 +75,11 @@ def __call__(self, *args, **kwargs):
7475
return self.__class__(self._val(*u_args, **kwargs), self._engine)
7576
return self
7677

77-
def __repr__(self): return str(self._val)
78+
def __repr__(self):
79+
return str(self._val)
80+
81+
def __str__(self):
82+
return str(self._val)
7883

7984
def lie_lookup(engine, func, key):
8085
if key.startswith('_'): raise AttributeError(key)

0 commit comments

Comments
 (0)