A while ago, I stumbled on somebody else’s blog entry Five things I hate about Python. The game (apparently) is to pick your favourite programming language and pick five things you don’t like about it.
So, here are my five things:
- No parallelism. The Python interpreter has a global lock that makes it impossible to parallelize execution. My processor has two cores, multiple pipelines, and a vector unit. Wouldn’t it be spiffy to use those? I have used the Parallel Python module to get around this (by spawning multiple interpreters), but it’s a hassle, and only applicable in certain cases.
To be fair, this is a common problem in imperative languages, which force the programmer to precisely specify how thing are calculated. It’s much easier for a compiler to parallelize things in functional language, which have the programmer specify only what is calculated. Maybe Haskell is the answer to all of our problems? Hey… why are all the 383 students looking at me like that?
- Late Binding. This is the mechanism that allows the beauty of duck typing, so it’s probably a net win. It comes up in situations like this:
def add(a,b): return a+b
Until the function is called, there’s no way for Python to know whether the
+there is addition, string concatenation, or something else. So, when each statement executes, Python has to decide what operators (or whatever) to use at that moment. The net result is slowing the language down a lot.
- Type confusion. I don’t know if it’s the duck typing or weak typing, but beginning programmers (aka CMPT 120 students) often have problems getting the type that a particular value has. I very often see students converting a type to itself. For example:
name = str(raw_input("Name: "))
count = int(0)
That indicates some serious confusion about what’s going on. Or maybe I’m a bad teacher. I’d accept that as an explanation.
- GUI libraries. The standard Python install comes with only a Tk binding for GUI development.
I really wish wxPython came with the default install. Then, we could all use it and assume it would be there. It would make Python a pretty serious contender for cross-platform GUI development.
- Standard library. One of the principles of Python is that “the batteries are included”. In other words, the libraries you need are there by default.
That’s usually true, but there are a few things I wish were always there. The Python modules that I seem to have to install the most often are: Biggles, Imaging, Numarray/Numeric, Parallel Python, PyGame.
As an aside, maybe if the Imaging and PyGame modules were accepted into the standard library, there would be some pressure to get some good documentation going for them.