A notch above a monkey

Why I passionately dislike Twisted and Zope

I’ve been a Python programmer for more than 6 years now and during most of this time it’s been the language I used professionally. It’s safe to say, I know it fairly well and I’m quite attached to it. I also have to admit that I can’t stand Twisted and Zope.

It’s a continuous wonder for me, why Python community chooses to promote projects that feel most unpythonic to me. I became addicted to Python, because it was a very simple, yet expressive language which lived up to its mantra of making easy things easy and hard things possible.

So what is actually easy with Twisted and Zope? Practically nothing. At least not as long as you don’t dedicate yourself to their use.

You see, Twisted and Zope are not products. They are religions.

They were not built in a way that would make it easy to integrate them with wonderful things others built. It’s not easy to just pick the parts you like and use them elsewhere.

No, like a good disciple you were supposed to study the way they work, use their new vocabulary and dedicate yourself to live within confines of chosen religion. If you do this, then you’ll get some payoff and you might after a while even think you enjoy it.

But you’ll be missing on a hell of a lot of stuff others made and you’ll have to live with limitations of not your choosing. Well, at least not completely.

I guess I wouldn’t find it so distressing, if I didn’t feel Python developers are getting too eager to add new features to please Zope and Twisted developers. Or features that were inspired by these two.

So this language I loved is with each new release becoming ever less clean and beautiful and it’s getting easier and easier to imagine a day, when I’ll switch to some other language as my main development tool.

Disclaimer: When I talked about Zope, I actually meant version 2.x, because it was the one I actually used on a project and left me scared badly enough that I can’t make myself to even check X3. I heard it’s better in many regards, but I really don’t care anymore.

I also think developers who created Zope and Twisted are amazing. I just think that their product is, well, unpleasant.

I'm a human, dammit!

I’ve changed a lot and a lot has changed for me, since I started my company. Among other I’ve became much more aware of the way businesses deal with me as a customer. Maybe it’s just me, but it usually sucks beyond belief.

Customer relationship management.

I’ve never heard anyone with a successful marriage describing living his relationship as managing it. If you give it a name like this, you’re off in a wrong direction already. No wonder dealing with most companies for me has an appeal of a full-body wax depilation.

There are rare exceptions. One of them is Tomaž, a computer hardware dealer who can get you practically anything you need. All it takes is an email with a short description of what I’m looking for and in shortest time possible I get it delivered personally to my doorstep. There’s no unnecessary bureaucracy, no trying to sell me something I didn’t ask for and I get a good price. In short, it’s a great service that leaves me to focus on really important stuff. And Tomaž gets more business from me than he would probably otherwise.

Why is this so hard for others to learn?

By the way, if you need to buy computer hardware and you want to get a good price with as little fuss as possible, please let me know and I’ll send you his email address.

Beautiful Soup is beautiful again

This is probably the last part in series of post dealing with Beautiful Soup. At least for a while. Good news is, I found the bug that caused observed weird behavior and it was partly self-inflicted.

My problem appeared, because I was using variables that resembled html tags (e.g. imgs, ul…) and didn’t put space after < in statements as good practice dictates. So I had statements like:

if (i<imgs.length)

Beautiful Soup relies on sgmllib.py for processing of documents and it’s sgmllib that causes havoc by processing CDATA (found in script and style blocks), when it shouldn’t. But the problem is not really with sgmllib, which has a literal switch to turn processing off. It’s just that Beautiful Soup doesn’t use it.

So fix is really adding one line

self.literal = 1

after if statement on line 835. Or downloading fixed version .

Reading source I also realized another potential pitfall. If you use javascript to inject javascript with document.write method, you’ll probably confuse sgmllib (and hence Beautiful Soup). When processing CDATA, it doesn’t try to understand it, it just copies data until it finds an endtag (</script> in javascript’s case). But if you’re doing that, you have yourself to blame.

BeautifulSoup 2.1.1 is out , which fixes my bug and several others. So you better fetch that version.