Hacker News new | past | comments | ask | show | jobs | submit login

Honestly, I think the Perl way is clearer than the Python way:

Perl: unary + is "convert to number", binary + is "convert operands to numbers and add". This is clear and consistent. String concatenation uses a different operator completely.

Python: binary + is string concatenation if the left operand is a string, and numeric addition if the left operator is a number. It fails at runtime if the right operator is inconsistent with the operation specified by the combination of the operator and the left operand.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: