What I Hate About Python
Posted Tuesday, January 14, 2014, at 1:51AM
During an interview a while back, I was asked to name some things I hate about Python. For some reason, I choked and couldn’t think of a good answer (I kind of wanted to blame the interview process, but that’s a rant for another time).
I did a search to see what other people don’t like about Python to get some inspiration, but I didn’t come across anything I truly hate.
Things That Don’t Bother Me
- Significant whitespace. I love it.
self. I guess it would be “convenient” if I didn’t have to add
selfto every method signature, but I really don’t spend much time on that, and it takes about 1ns to type (in fact, my IDE fills it in for me). There are technical and stylistic considerations here, but the upshot for me is that it just doesn’t matter, and I actually like that all instance attribute access requires the
lambda. There are rare occasions where I want to define more complex anonymous functions, but there’s no loss of expressiveness from having to use a “regular” named function instead. Maybe multi-line anonymous functions that allow statements would lead to different/better ways of thinking about programs, but I’m not particularly convinced of that. (Aside: one thing I do hate relating to this is the conflation of
lambdas and closures–normal functions are closures in the same way that lambdas are.)
- Packaging. I don’t know why, but I’ve never had any problems with setuptools. There are some issues with the installation of eggs when using
easy_install, but I think
pipfixes them. I am glad that setuptools is now being actively developed again and the distribute fork is no longer necessary.
- Performance, GIL, etc. I’ve used Python for some pretty serious data crunching (hello,
multiprocessing) as well as for Web stuff. There are cases where something else might have been faster, but Python has almost never been too slow (caveat: for my use cases). Of course, Python isn’t suitable for some things, but for most of the things I need to do, it’s plenty fast enough.
len(), et al. I don’t have anything to say about this other than it’s a complete non-issue for me. Commentary about how this means Python isn’t purely object-oriented makes me a little cranky.
Things That Bug Me a Little Bit
- The way
superworks in Python 2 is kind of annoying (being required to pass the class and self in the
super()call). This is fixed in Python 3, where you can just say
super().method()in the common case.
- Unicode vs bytes in Python 2. This is also fixed in Python 3 (some people have argued that it’s not, but I haven’t run into any issues with it yet (maybe it’s because I’m working on a Python 3 only project?)).
- The implicit namespace package support added in Python 3.3 causes some trouble for my IDE (PyCharm), but I’m assuming this is a temporary problem. I also had some trouble using nose and py.test with namespace packages. Again, I assume (hope) this is only temporary.
Things That Bother Me a Little More
- The Python 2⁄3 gap is a bit troublesome. Sometimes I think the perception that there’s a problem may be more of a problem, but I don’t maintain any major open source projects, so I’m not qualified to say much about this. Personally, I’ve really been enjoying Python 3, and I do think it offers some worthwhile advantages over Python 2.
There isn’t one. I left some things out intentionally (various quirks). I probably forgot some things too.