Re:Why Python is Slow: Looking Under the Hood
by rectangletangle on Friday May 09, 2014 @03:00PM
(#7722697)
Python is a strong dynamically typed language. Unlike JavaScript, which is a weak dynamically typed language. In Python `'1' + 0` throws a `TypeError`. While JavaScript attempts to figure out what you meant.
[ Parent
| on HN ]
Re:Why Python is Slow: Looking Under the Hood
by Chattered on Friday May 09, 2014 @06:41PM
(#7723634)
Which would be fine if I only ever used "+" with literals. But normally, I write things like
x + y
where x and y are values I got from who knows where. Javascript shouldn't pretend to figure out what I mean by this, because in many cases, I'm talking gibberish, and all I have is a bug.
I'd rather not talk about this stuff in terms of "types." It's about assertions, and Python makes them early and throws the exceptions early. It's a defensive practice that you can emulate in any language, and your assertions can be much richer than anything that is typically thought of as a type.
Re:Why Python is Slow: Looking Under the Hood
by rectangletangle on Friday May 09, 2014 @11:13PM
(#7724352)
I'm definitely a fan of Python's strategy. It's much better at detecting bugs early and often. That, and there's a distinction in Python between identity and equality, with the `is` and `==` operators respectively.
Re:Why Python is Slow: Looking Under the Hood
by thaumasiotes on Saturday May 10, 2014 @08:41AM
(#7725192)
Frankly, I think Perl has the best approach to this specific problem. We all want to do some string concatenation. We all want to render some non-string values as strings sometimes. So:
1 + 0 = 1
1 . 0 = 10
Just stop using + to concatenate strings.