[Tim] > It's certainly caught errors for me, and especially when > introducing Perl programmers to Python, where "they expect" > string+number to convert the string to a number, apparently > the opposite of the arbitrary choice Paul prefers. [Ping] > It's not arbitrary -- the decision is made according to the > type of the *operator* rather than the type of the operands. > > anything + anything returns a number > anything . anything returns a string Of the languages discussed, this is true only in Perl. The other languages map "+" to the string meaning, so it's arbitrary wrt the universe under discussion. Toss Icon into the Perl camp on this one, btw. Within Perl, that "+" means numeric addition and "." string catenation is also abitrary -- it could just as well have been the other way around. Perl simply aped Awk's arbitrary <wink> choice for what "+" means. > So "34"+0 converts to a number and 34."" converts to a string > (i've seen both idioms fairly often). Yes, & about as often as you see explicit str() or int() calls in Python. It's not a question of not needing the functionality, but of how to spell it (both!). > ... > there's really no excuse for not being explicit. i-think-that's-what-i-said-the-first-time<wink>-ly y'rs - tim
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4