A comment in Joel Spolsky’s How Microsoft Lost the API War got me thinking about what really makes a programming language more productive.

The real significant productivity advance we’ve had in programming has been from languages which manage memory for you automatically. It can be with reference counting or garbage collection; it can be Java, Lisp, Visual Basic (even 1.0), Smalltalk, or any of a number of scripting languages. If your programming language allows you to grab a chunk of memory without thinking about how it’s going to be released when you’re done with it, you’re using a managed-memory language, and you are going to be much more efficient than someone using a language in which you have to explicitly manage memory. Whenever you hear someone bragging about how productive their language is, they’re probably getting most of that productivity from the automated memory management, even if they misattribute it.

I disagree. Well, sort of; I’ll explain in a minute. When I think about why I prefer to work in Python when I can, automatic memory management doesn’t come to mind. What does come to mind is the availability of collection types such as lists/tuples and dictionaries. Not only are they there in the sense that I can construct and operate on collections, but I can do so easily. I can construct them inline, pick them apart inline, iterate over them, even pass slices of them around with just a flick of the keyboard. I can make a function that returns multiple values just by wrapping them up in a list or tuple and writing “x, y = f()” in the caller. Even the most “advanced” C++ with STL and overloading and whatnot doesn’t give me the same level of convenience or consistency with regard to this basic functionality.

Now, one could reasonably argue that what makes all of these collection types feasible is automatic memory management; that’s the “sort of” I mentioned above. However, automatic memory management by itself doesn’t get me all that much. What really helps to make me more productive in Python is using that to create convenient collection types. That second step – not the first – is where I get the real bang for my programming buck.