It’s been too long since I’ve written a non-trivial amount of Python and for the last couple of days I’ve been spending some time to look around and see what got better and what still sucks in Python land. The good news is that a lot of things have gotten better, including the language itself. Sadly, Python is still missing a clean way to represent enclosed scope, which seems totally out of kilter for a language that is otherwise so dynamic. Sure, you return a named throw-away function from another function in order to generate a closure, but you can’t create an anonymous variant of the same thing. Also, Python’s
function and Ruby’s blocks still have Python by the balls on this one.
Also, I’m not sold on decorators. The burgeoning catastrophe that is Java 5 annotations should be an object lesson, but I’m afraid good taste hasn’t prevailed in either language yet. But whatever quibbles I might have with various syntactic forms in modern Python, it’s still the best thing going. Idiomatic Python remains readable, audit-able, and fast.
Here’s the short list of the toolchain I’m assembling for an upcoming project:
While the greenlet project looks like an interesting alternative to Twisted, it doesn’t look “baked” enough to handle most of the situations I’ll be relying on Twisted for. In much the same way that library depth is the only reason I keep inflicting Java on myself, protocol implementation breadth and depth are the reasons that Twisted probably has very long legs, despite the kludgyness of requiring factory classes every time you want to sneeze.
I’m tremendously excited about lxml. It implements the ElementTree API but extends it with all kinds of XPath and XSLT goodies that make doing XML in Python much less painful than the cluster-fuck that is 4suite and PyXML. Our long XML processing nightmare may finally be over, no surprise, thanks to libxml/libxslt.
Is there anything that I’ve totally missed in the last 2+ years of Python development that I shouldn’t be going without?