4 ms·
Right. Students in my Python classes (who typically come from static, compiled languages) are always asking me how quickly certain operations execute, or how m
by reuven 12y ago
Right. Students in my Python classes (who typically come from static, compiled languages) are always asking me how quickly certain operations execute, or how much memory is used.
I try to explain to them that obviously Python developers care about these things, and I show them some of the most common pitfalls. But this isn't the first, or even fifth, thing that you think about when you're coding in Python.
The key thing to remember with dynamic languages, and particularly interpreted dynamic languages, is that they're optimized for programmer speed, not execution speed. And that's fine nowadays, when programmers are expensive and computers are not.
So yeah, maybe Go will run your program 100 times faster. And there are cases when that's important. But in most cases, it's not, and the benefits that you'll get from having a happy, efficient developer will be more than worthwhile.
- enneff 12y agoSpeed is low on my list as to why I prefer Go over Python. (In fact, Go isn't necessarily fast. It's just that Python is unnecessarily slow.) Having a decent type system and decent concurrency primitives are far more attractive.
- reuven 12y agoI've never found myself wishing for a better type system, although maybe I've just been steeped in the world of dynamic, strongly typed languages for too long. But there's no doubt that concurrency is indeed one of Python's weak points, and Go's strong points.
- kazagistar 12y agoI never found myself wishing for a better type system, because my idea of "static" typing came from C and Java, where it is mixed up with variable declaration, state, and a bunch of other things it has no right to be associated with. Basically, I was scarred. A good type system quietly and with minimal programmer effort encodes and documents your code, helps you find mistakes faster, guides your re-factoring, and gets out of your way when you don't want to deal with it.
- ekianjo 12y ago> It's just that Python is unnecessarily slow. It's not Python that's slow, it's CPython. If you use PyPy you get a much faster implementation of Python, not too far from Go speed.
- mimighost 12y agoIHMO, PyPy isn't a strong counter-argument for Python's slowness. Yes, PyPy is probably faster than CPython. But what then? In most cases, CPython is THE PYTHON. PyPy is still in its early age and has a lot to demonstrate itself as a serious alternative to CPython. On the other hand, programmer could get out-of-box performance boost from adapting Go without worrying the potential compatibility issues. PyPy is a very interesting and promising project. I highly respect that. I just don't like the idea of merely using it to dodge the blame of performance slowness, when what people are really talking about is CPython.
- Daishiman 12y agoI would say Go's type system is the least impressive of its features when compared to most other statically typed languages.
- Istof 12y agobut for an interpreted dynamic language, python is particularly slow when compared to other popular ones (for execution time).