Five things I hate about Python

January 29th, 2008, 10:15 pm PST by Greg

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.

This seems most common among the Python crowd: Python 2, Python 3, Python 4. It’s probably because everybody loves Python. But, I did manage to find a few others: C,
Vista, Linux.

So, here are my five things:

  1. 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?

  2. 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.

    Apparently PyPy has some improvement here, and Pyrex allows extension modules with early binding.

  3. 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.

  4. 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.

  5. 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.

5 Responses to “Five things I hate about Python”

  1. Eugene Says:

    383 ruined functional programming for me for almost a year. Haskell is dead to me. Lisp I can still appreciate.

  2. Perlish Says:

    It sounds strange. However, it’s still useful to implement cgi, cause the parallelism is managed outside (I suppose). I think strongly typed languages are more suitable for educational purposes because they involve less “random manipulations” in order to make the compiler shut up. When a C program fail, u have a big “bang”, something concrete like a segmentation fault.

    I have recently lost time because the .net’s JDBC (ADO.NET) decided to bind the number field of my database with … a short int. I used all the cast I knowed until I realize that “short” int exist in .net.

  3. Greg Says:

    Uh… that was a machine generated comment, right?

  4. yangman Says:

    I still like Haskell…

  5. perlish Says:

    No :'(