differentmatt / filbert

JavaScript parser of Python
Other
133 stars 27 forks source link

Strings and numbers shouldn't be addable #62

Open dzhang314 opened 9 years ago

dzhang314 commented 9 years ago

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 commented 9 years ago

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