Which language to learn?

Pintreo Mardi just asked, on the Python mailing list, a very simple question:

Is the Python language an all in one computer language which could replace C, C++, Java etc?

I kind of liked my answer, so I'm reproducing it here:

That's a really hard question to answer, or at least to answer well.

At a theoretical level, when you ask, "Is Python equivalent to C, C++ and Java", the answer is "yes". In computer science, programming languages are classified by whether they are "Turing Complete" or not (google that for more info). In theory, any Turing Complete language is capable of writing all programs which can be written in any other Turing Complete language. All of the languages you mention are Turing Complete, so, theoretically, they are all equivalent.

But, at a more practical level, some languages are easier to learn, some run faster, some are more portable, some are more convenient to use, etc. If I had to rank the languages you mention by a few categories, I'd say something like:

  • Python: Easiest to learn (and use), slowest execution speed.
  • C: Pretty easy to learn, but difficult to write large projects in, fastest execution speed.
  • C++: Hardest to learn, hard to use, speed close to C.
  • Java: Somewhere in-between Python and C++ on all counts.

All of these are currently in widespread commercial use today, so you can't go too far wrong starting out with any of them. The TIOBE people have been tracking programming language popularity for a long time (http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html), so that's a good place to get some vague idea of what's hot and what's not.

One thing to be aware of is that some programming domains require a specific language. If you want to do iOS, you need Objective C. For Android, Java. Web front-end programming, Javascript. No getting away from those. In the server environment, it's a much more wide-open field. People write web servers, for example, in Python, Ruby, Scala, Javascript, PHP, Java, and probably a host of other languages.

This has already turned into a longer essay than I intended, but there's just one thing I wanted to add. Whatever you pick to learn first, realize that if you embark on a life-long career in programming, it won't be your last. Languages come and go. I've done serious work in (in vaguely chronological order) Fortran, C, Python, Tcl, Perl, C++, and PHP.

So, pick one, spend a year getting really good at it, then pick another language, preferably one that's very different, and learn that too. Repeat every so often :-)