filbert icon indicating copy to clipboard operation
filbert copied to clipboard

Strings and numbers shouldn't be addable

Open dzhang314 opened this issue 9 years ago • 1 comments

Currently, adding a string to a number (in either order) casts the number to a string and concatenates:

"abc" + 123 == "abc123"
123 + "abc" == "123abc"

Both should throw a TypeError.

dzhang314 avatar May 18 '15 20:05 dzhang314

On a related note, sum() shouldn't work on lists of strings. Currently, sum(["a", "b", "c"]) produces "0abc".

dzhang314 avatar May 18 '15 21:05 dzhang314