Thursday, May 05, 2005

Python: it's just better

I just did a utility in Python where I took the content from a large table from a technical manual in Word and displayed it on a GUI in a tree view. I just exported the Word table to a delimited text file and the Python script parsed the text file and built up the content for the tree view. It was not too difficult.

That's the thing with Python. Everything just seems easier and faster. With Python you'll be trying to do something, then you'll find the way to do it in Python is just ridiculously easy.

Python is better because it addresses the programmer impedance issue. When I work on a technical problem, I like to solve the problem in my mind, then just type up the solution using the editor. With other languages, programmer impedance occurs when I have to translate how I think about the solution in my mind to how I express that solution using a programming language. With Python it is generally one-to-one how the solution in my mind maps to statements in Python. So the impedance is eliminated or at least massively reduced.

Here's an example. I once had a situation where I needed to "select an item from the set at random".

In Python that can be expressed as random(set). No impedance.

In say, Java I have to translate. I have to do something like
get the size of the set
get a random integer x between 0 and set size - 1
get item x from the set
print the code and read it carefully checking for off by one errors

That's an example of the impedance. By the time I obtain the random item in Java I've lost my flow and have to spend time getting momentum back. In Python with no impedance I don't lose my train of thought.

I'm not picking on Java. I like Java. I've worked with Java and C/C++. I consider Java better than C/C++. I consider Python better than Java.

I've read some people who say that the programming language doesn't matter. What's important is that there be a vast standard library. This may be true when comparing Java to C/C++. For me what makes Java compelling compared to C/C++ is the vast standard library, built in GC, platform independance, built in threading.

However looking at the modern language landscape with Java, C# and Python, the things that gave Java an advantage over C/C++ are just commodities today. Any modern language will have the large standard library, OO, GC, multi platform, and threading out of the box.

So some other commentators got it wrong. It is about the language. And Python is just better. Besides fixing the impedance issue, Python also eliminates the compile cycle. That alone yields a significant developer productivity increase.

No comments: