Concurrency in Go and Rust
Go or Python -- which one is my main language for the next 5 to 10 years?
Learn more languages. Don't be lazy. No one ever got a job for knowing one fewer language.
More on reddit.comGo or Python?
Why are people ditching python for go?
As a python programmer by trade, here are three reasons not to use python:
-
Dynamic compilation can result in errors that exist in code, but are not detected:
This is perfrectly valid python:
def junk(): afdfaf asdfd fdafd / dsfsaf()
Of course if you add junk() to the end, it will fail with errors about missing functions and variables; but compiled languages like go don't suffer from this problem.
-
CPython really is very slow.
Very specifically, procedures that are invoked multiple times are not optimized to run more quickly in future runs (like pypy), they always run at the same slow speed. So operations like populating matricies and doing matrix maths are really slow. So slow in fact that future version (3.5? See http://legacy.python.org/dev/peps/pep-0465/#discussions-of-this-pep) will have an explicit operator for this.
You can get around this by calling c libraries, but it's irritating as a developer to write something in python, realize its too slow, and then have to rewrite it again in C. Very. Very. Irritating.
-
Python has a terrible distribution story.
Virtualenv, buildout, pip, easy_install, distribute: they all boil down to the same thing; it's really hard to ship all your python dependencies onto a new system.
...and even then, if you have a perfectly setup version pin for every library, it can still break when (for example) freetype upgrades and your old pinned version of Pillow doesn't compile any more. Oh? You had some dependencies on the old version of pillow? Upgrade all the things!
There are a few 'binary builders' for python like pyinstaller, cx_freeze; but they're pretty rubbish practically speaking. Even the best showcase of these tools ends up shipping simple GUI apps like Calibre that are hundreds of megabytes in size.
Let's not even talk about writing something in py3 and getting half way in to discover a core dependency hasn't been ported yet.
.
Go addresses those points pretty sharply; good distribution story with static binaries; repeatable build process (abit hindered by the same issues as python when you bind a c library; but at least you can statically link C libraries into go binaries), and it's really pretty fast.
So is it worth abandoning python?
Probably, professionally, not really; especially if you're looking at web development.
The ecosystem for python is really strong, and there are some really decent web tool kits like flask, pyramid, some great libraries like sqlalchemy, and a lot of support for it from the academic community for stuff like natural language processing.
...but would I build a GUI app or a game in it instead of Java or Go if I had to start tomorrow?
Absolutely fucking not.
More on reddit.com