- Whitespace - Low-hanging fruit. The whole whitespace thing is Python's bugaboo the way that speed is/was for Java and a resemblance to line noise is for Perl. But there is still something here, and not the usual "OMG it makes me indent!" that shows up. The problem is that using whitespace as the delimiter causes issues when modifying code later. A very, very common maintenance idiom is taking a block of code and wrapping it with an if statement because you've found cases where it shouldn't be run. In C-styled languages, when using emacs, the usual way I've done this is to put in the if statement, then walk through the code, reindenting each line with the tab key, until it's time to close the block. In Python, if you try this, you will screw up the indentation for each block inside the new block you're creating. More generally, programming in C-styled languages in emacs teaches you that re-indenting with tab does not semantically change the program; that's no longer the case in Python. (Other editors generally have similar concepts; it's not just an emacs thing.) Or, in the general case again - if you lose leading whitespace in a Python program somehow, there is no automatic way to get it back. (This can happen with a bad translation to HTML, a funky mail filter, or many other ways.) Now, there are ways to work around this (ending all blocks with 'pass', '#end if' comments, etc.), decent editor support makes it less of a problem, and there are advantages to Python's approach, but it's not without its issues as well.
- PyGTK - Not entirely Python's fault here, I suppose, but PyGTK is quite possibly the least intuitive, most annoying GUI toolkit I've ever worked with. (And, remember, I've worked with both Java AWT and Swing.) GtkTreeView in particular is just plain twisted.
- Python People - Mention #1 to a Python advocate, and...hoo boy. Python's got some damn good Kool-Aid, I guess. Any mention that there is possibly a problem with using whitespace as the delimiter is met with either blaming the user ("Well, clearly you shouldn't be editing that way, then") or shifting the issue ("Well, you'd have to fix the indents anyway, right?") and missing the point that making whitespace significant causes issues of its own.
Wednesday, May 14, 2008
Things I Hate About You #3: Python
This one's tougher, because my Python isn't anywhere near as good as my Perl or Java.