Take the 2-minute tour ×

I am in the process of applying to a Computer Science program which requires students to have at least an intro-level exposure to either Java, C or C++. I have some experience with Python and I would prefer to continue working in Python before starting another language; however, the professor said that Python was too light, i.e. "it's just a scripting language, you need to know a more robust language".

Is there really that much benefit in learning Java, C or C++ over Python?

If so, which of the three would be the best second language and why?

What concepts will I better grasp by learning Java, C, or C++ as opposed to Python? For example, here are the topics they have on the exemption exam -- which they only offer in Java or C++:

  • Basic Syntax and Punctuation
  • Reserved Words, Legal Variable Names
  • Variable Types: Built In and User Defined, Mixed Types
  • Looping Constructs: while, for, repeat
  • Branching Control Statements
  • Data Declarations: Arrays and Structs and Classes
  • Scope and Duration of Variables
  • OOP Principles
  • Simple I/O including formatting output
  • Reading and Writing to a Named File
  • Simple Recursion
  • Dynamic Allocation
share|improve this question
your professor is wrong. Python is excellent robust language. on the other hand, computer science should not be so much as learning particular language but rather algorithms and theory, for which python is excellent (for example functional, OO programming) –  Anycorn Jul 26 '10 at 20:04
@aaa: I heartilly agree that Python is an excellent language. However, as with any language it has strengths and weeknesses. For example, I'd suggest that C is a better language for work related to Operating System theory. –  torak Jul 26 '10 at 20:10
The decision of which language is "best" for you will probably depend, at least in part, on what kind of code you expect to be working on. –  torak Jul 26 '10 at 20:13
@torak true, but the introduction should not be about operating systems. In my opinion python has very good balance and few weak spots. Dismiss it as scripting language is absurd. out of points provided, python satisfies all of them (except of course syntax issues) –  Anycorn Jul 26 '10 at 20:20
I think the missing part of this is what you want to do. Do you just want to get into the program? Once in, what do you want to learn? What sort of programming attracts you? I can see any of the three being best, but it depends on your goals and plans. –  David Thornley Jul 26 '10 at 20:44
show 3 more comments

17 Answers

up vote 60 down vote accepted

Your direct question is "Which complements Python best?", but the implicit question seems to be "what do I need to do to deal with a twisted academia?". The answer to the latter question is Java.

On the other hand, if you truly want a complement to Python, I'd pick the one with the least overlap with Python, while being the most useful in direct conjunction with Python.

Of the three languages you mentioned, the one that fits those criteria best is, in my opinion, C.

  • There are very few projects where the question arises "Python or C?", because they generally serve very different needs.
  • The reference implementation for Python, CPython, is written in C.
  • Python extensions are often written in C either for performance or for ease of integration with other non-Python libraries.

One final thing that pushes for C: it shows you how computers actually work, instead of a very high-level abstraction. Once you're proficient in C, lots of things in higher level languages make more sense, and you can think more clearly about performance and memory implications of your programs.

share|improve this answer
That last part cannot be overstated. Python's great, but learning C has been time well spent. C makes more advanced concepts much easier to grasp, and you'll get a much deeper understanding. –  chimeracoder Jul 26 '10 at 21:17
Second this. Python will get you all the priciples of OO, Dynamic languages and verious other "modern" constructs. C will get you as close to the working of a modern processor as you will ever want to go. The tso languages complement each other perfectly. C++ while good is actually very quirky and hard to learn. –  James Anderson Jul 27 '10 at 1:08
Learning C doesn't teach you how computers actually work any more than learning how to drive stick teaches you how a car actually works. C has a simple memory model that in no way reflects what actual hardware does in any way shape or form. C's simple execution model in no way reflects the multi-issue, Out of order execution monster in the modern desktop. –  stonemetal Jul 27 '10 at 13:43
@stonemetal: I disagree. In learning how to drive a stick shift, I found myself wondering what the numbers were, so I learned about the engine and its gears. Do I understand a whole car? No. Do I understand it well enough to repair it? No. But I do have a basic understanding that allows me to comprehend a bit more of what's going on under the hood, and I feel the same way about learning C for its low-levelness. –  Maulrus Jul 27 '10 at 15:34
But a modern processor is like having an automatic car with a stick shaft added on for backwards compatibility. Learning how computers used to work is very nice for historic reasons but you should take the lessons learned with a grain of salt. What once was an optimization is now often a de-optimization. –  Mark Byers Jul 28 '10 at 14:37
show 2 more comments

I think C would be a good language to learn. Yes, it isn't OOP but in the same way you shouldn't learn only procedural languages, you also shouldn't learn only OOP languages. C is also the lowest level of the three and will give you a very good insight to how the processor actually handles your code. Also, there is something to be said of working without a garbage collector and without a nice and spiffy String class

share|improve this answer
+1, moreover very straightforward integration with python through ctypes where low-level details/performance kernels can be implemented in C/C++ –  Anycorn Jul 26 '10 at 20:24
add comment

Having spent a year in C++, a semester in Java (Spring 2010 - this last one), and learning Python mostly on my own throughout, and brief collisions, I'll give you an analysis of my experiences, along with my own opinions. I won't bother further addressing the silly comment that indicates how little you should pay attention to that professor (although he may be perfectly competent and amazing elsewhere).


An old language, with tons and tons of documentation, most of it useless. This is just about the best reference that I've come across on the internet. The best thing that you can possibly learn from C++ is pointers. If you don't understand pointers, you don't understand computers. They feel really simple to me, but apparently tons of people have problems with them. Of course I also spent a few hours playing with them to really understand the difference between &, *, and []. It's been a few years now, and I've kinda forgot most of the implementation details, but the understanding never leaves.

Other than pointers, C++ objects kinda suck, the namespaces kinda suck, and the standard libs aren't anywhere close to as awesome as Python. Pointers (and manual memory management) are the only things that you can learn in C++ (that I know of), that you can't learn in Python.


My favorite other language. You really learn how the computer works at a hardware level. You learn how your data structures (more or less) are implemented - things like strings, etc.

Assembly is so very very basic, but you really learn about what your computer is doing when you type x += 3.

I loved Assembly - it was one of the best languages I've learned so far, and I learned a lot about the basic stuff. There's not a lot more I can say about it because I didn't learn any abstract ideas or concepts - it was a bit like working on a car and then taking physics and chemistry courses. It may not help much in the way of putting a carburetor back together, but you really understand why that particular gear ratio allows you to get up and go.


I've only had the teeniest exposure to this language, and honestly I'd probably recommend learning this rather than C++. Why? Because even though C++ gives you higher level features, you won't get any benefit because they're simply less powerful versions of Python types. At the best you might get some speed from C++, but you can get that same speed from C, and C gives you a good intermediate step between Assembly and C++. I may have to go teach myself C sometime soon - especially if I have any (hahah!) free time this next semester.


I saved the best worst for last. I know there are tons of Java fans out there (my brother is one), but honestly I don't get it. I went into this class expecting to learn something and all I learned was syntax! Oh I guess I learned some of their toolkits, but that was literally it - syntax. I think this quote by sums up my experience and feelings:


-A. Stepanov

That's quite how I felt, too.


You should learn a new, lower level language that teaches you something new and gives you something that Python can't. Java won't (compiled to byte-code is not giving YOU something, it's giving the computer something). If you have the choice I would 100% recommend C - it's closer to Assembly and so it offers two things: Speed, and a greater comprehension of what's really going on "under the hood", so to speak. If you have the chance I'd also recommend taking an Assembly class. If you can't choose C, then go with C++ because even if you aren't quite as low level as C, you're 100x better than Java because you'll actually learn something new. You can pick up syntax in a week, but a true understanding of a computer really needs lower level comprehension. And as an added bonus, if you learn C or C++ you can easily extend Python, whee!

(Also, if your professor continues to make fallacious statements like that, and if they don't offer REAL courses like Assembly and C/C++, I might look for a new university).

share|improve this answer
This should be closed ans not real answer. It's difficult to tell what is being said here. This answer is ambiguous, vague, incomplete, or rhetorical. –  Gianluca Jul 27 '10 at 13:10
add comment

first of all - heartily agree with aaa - Python is not just a scripting language

I would recommend learning C - it's a much lower level than Python and gives you none of the higher level structures that make programming 'easy'.

Building ADTs and writing functional C code really gives you an appreciation of how much work higher level languages such as Python can save us.

Then, once you're comfortable with how the underlying concepts are built, you never need to write them again. :)

share|improve this answer
* unless you go into the embedded or driver industry :) –  Earlz Jul 26 '10 at 20:21
add comment

Avoiding the trap of commenting on "it's just a scripting language"...

For these purposes, I'll eliminate C, as I expect they'd prefer an object-oriented language. Otherwise, I'd follow Joel Spolsky's advice (starting about 3/4 through the transcript) and say to learn it (C).

Admittedly, I've done a lot more Java than C++ (and more Python and C than either of those), but I'd say that learning Java is easier and I find it less painful to work with as long as you can accomplish what you need with it, so I'd recommend that.

You may want to look at Joel's article about Java in schools.

Edit in reply to the updated question: While there will be some differences in the specifics between the languages, the only subject I'd say you will learn in C++ but not in Java is dynamic allocation (and some may argue that), as in C++ (and C), you have to call functions to tell the operating system to supply more memory to the program. In my mind, that is dynamic allocation.

share|improve this answer
add comment

If you really want to stick with Python, it's worth noting that the most commonly used implementation (CPython) is written and extended in C. Not C++, but C.

Falling into being trolled by your professor, Python is truly a very powerful language. It's not bash. See: django, pylons, numpy, zope, etc.

Personally, I write C for work. Anything I don't have to write in C gets written in Python. I'm not in school, and my educational background isn't CS, but that's what life can be like in industry. When coder time matters, Python is a solid high level language. When code size matters, C is the point beyond which most returns diminish quickly.

share|improve this answer
The view (of his professor) is rather common in universities. Usually the arguments boil down to this: if it is not a compile-time static type checking language, it is not a serious language. Most students just inherit this view –  Anthony Kong Jul 26 '10 at 20:36
@Anthony: If by serious you mean “makes you frown a lot and look very serious” then compile-time statically-typed languages are indeed serious languages. (I prefer things to be dynamic.) –  Donal Fellows Jul 26 '10 at 20:46
@Donal: This is not my view. I am just reporting this is a rather common view I have come across in academia/teaching community. I use python at work –  Anthony Kong Jul 26 '10 at 21:31
@Anthony: Don't worry. I work in an academic setting, and there's lots of Ruby and Java used in practice here. Moreover, I'm a developer of Tcl so I really know the benefits of scripting languages, and don't consider them to be anything other than full languages. They just don't insist on the user praying before the god of compilation before use. :-) –  Donal Fellows Jul 27 '10 at 8:49
add comment

They are all pretty different from Python and they are all somewhat similar to one another.

Opinions will no doubt be strong about which one would be the best. I would recommend Java based on object-orientation and garbage collection.

As far as the benefit goes, there is always a benefit in learning a new language that is different in some significant way from what you already know. Also, you're highly more likely to get a job working in Java.

share|improve this answer
In what way is Java significantly different than Python? –  Wayne Werner Jul 26 '10 at 21:01
Java is statically typed and Python is dynamically typed. They are also seem to me to be very different philosophically. Python is compact and concise, Java large and verbose. I hate to bring up the syntax issue, but for someone with only one language under their belt the difference between curly braces and white space could feel fairly significant. Also, Python embraces a lot of functional aspects that you don't find as much in Java. –  wshato Jul 26 '10 at 21:15
add comment

I would say it depends on what you're planning to study in the program. If you're on the "systems track" (i.e. operating systems, deep networking, etc.), you're going to need C. C is definitely the most different from Python of those you listed. As an added bonus, it's by far the smallest of the three in terms of syntactical structure and library content--thus, the easiest to learn, if you can wrap your head around pointers.

C++ is a nice middle ground between C & Python. You'll get operator overloading and other pythonesque niceties, as well as a more capable standard library, with the power of C. There are also nice facilities for interoperability with Python (e.g. SWIG & boost.python). But C++ is a huge language syntactically, so it will be a long time before you're fully able to harness it's power. That said, you'll be able to do useful work in it before too long.

Java has the advantage (and disadvantage) of having an absolutely enormous standard library--Java programs tend to be exercises in integrating already existing components, rather than creating a lot of new capability from scratch.

My recommendation would be to start with C because you'll get the most benefit in the limited time before your degree program starts. You'll have time to pick up Java & C++ later while doing SW engineering courses or other "applications track" work.

Good luck in school!

share|improve this answer
add comment

If you already know Python, I would recommend learning C. They’re often employed in quite different environments, so it would be great for expanding your knowledge. C is also particularly useful to know because it will help your understanding of low–level concepts (which in my experience has made me a better coder in higher–level languages).

share|improve this answer
add comment

The answer depends much on what you are trying to achieve with a programming language. If you need the speed and ease of working then any dynamic language like python, ruby etc are languages of choice.

If you are looking for performance, finer control and robustness then its difficult to find a substitute for C/C++. You can even mix and match these languages to create robust and scalable applications (see Boost::Python and SWIG).

If you need the best of both worlds in a single language then "Google Go" is the one for you. Though its in a pretty nascent stage, but still the language design and the thought behind it is pretty impressive. Programming is fun with "Google Go".

If you prefer conciseness of expression and you are a fan of JVM then try Scala.

share|improve this answer
add comment

Since you already know some programming, and probably most concepts they want to teach you in this course, I suggest the Bruce Eckel route:

  • read "Thinking in C++"
  • no, first read his introduction "Thinking in C"
    • actually I think he also has a "Thinking in Java"
  • if you still have time left
    • read "The C Programming Language" by K&R (excellent examples!)
    • read "Refactoring" by Martin Fowler
    • read through the first part of the GoF book (don't memorize the patterns, just read through their example wordprocessor project - they explain really nicely why they use which pattern and how it solves their problems in a coherent software project)

This will give you a background in C and some C++ while still being entertaining: It is not so much about the syntax as about the why stuff is done in C++ the way it is. You will have ever so many enlightened moments.

If you decide to go the Java path (way less syntax to learn than C++ and will leave you more or less sane in the head), then you should probably also read the intro chapters from Java in a Nutshell...

share|improve this answer
add comment

Learn them all! C, C++ and Java has similarities, learn C, then C++, and then java (the strictest first).

In my studies I have been required to program in C, C++ and Java, but also PHP, Basic, LISP and ML. This did that when I got my first Python assignment on work, it did not take me any time at all to understand how to program in python.

So my tip is learn as many languages as possible, it will make you a better programmer.

share|improve this answer
add comment

As someone who started out writing in assembler, then C, then C++, then Java, I agree..learn them all (eventually). Your experience in lower languages (how a computer actually works, how registers and memory management works, what REALLY happens on the stack ) serves you well in any higher level language.

(Side note, knowing assembler made pointers a nonissue. Bonus!)

For your exam, though, my vote is for C, and for your career, my advise is always learn something new and stretch your mind. Why be a developer if you aren't learning something new all the time?

share|improve this answer
add comment

I would learn Java for your studies, as it's more closely related to Python.

If you want to learn how a computer really works then take a look and possibly learn a bit about writing c programs.

share|improve this answer
add comment

I am Agreeing with the Kent,even though, i like to say, Study Java, it will make the development easy and more over you will get high scalable application

share|improve this answer
add comment

First of all, don't worry too much; learning a second programming language is much easier than learning the first one :)

Second, I'd like to challenge the opinion underlying many of the answers that your professor is an idiot ;). I spend most of these days coding python, and love it, so this is not an anti-python rant. Also, "just a scripting language" is clearly wrong and I'm not even going to go into this. Still, there's something to be said about having experienced a language in which you have to care about the declaration, type, and (in the case of C/C++) storage in memory of your variables.

To finally answer your question (again ;), I'd agree on C as the most unrelated to python. Looking at the topics however, it seems that OOP is an issue, so I'd then go for C++.

share|improve this answer
add comment

I would recommend Java, as it has less learning overhead (memory allocation, different architectures), and allows you to easily tie any new knowledge into the writing of Jython libraries, which will let you speed up your Python programs.

share|improve this answer
add comment

Your Answer


