Hacking, Software Collaboration, Testing and Diverse Other Topics of General Interest to the Practicing Programmer

Tuesday, June 30, 2009

Twisted huh?

One of the hallway conversations I've had a few times so far at EuroPython goes like this:

A: Twisted's got some good stuff going for it, but I don't like the way it forces me to use Zope interfaces. It's too heavyweight?
B: Huh? What do you mean? It doesn't make you do that.
C: Yeah, there's lots of deep inheritance, which just feels really wrong.
A: Right, I have to write too much code to get something simple working.
B: Sorry, I have no idea what you mean. Can you give a concrete example?
A, C: I can't think of one right now.

To me, this is a very intriguing beginning to a real conversation. Do you know what A and C might mean here? I'd love to understand their points so that I can form an opinion.

Thursday, June 25, 2009

Argh!

I upgraded karmic, and now Do & Banshee are broken. :(

Wednesday, June 3, 2009

pyflakes now warns about unused local variables

I finally got around to finishing my fix for Divmod bug #2718 -- Warn about unused variables in methods in pyflakes. Last night, the magnificent Jean-Paul Calderone reviewed and landed my patch. This means that if you are using pyflakes trunk (either from Subversion trunk or from the Launchpad Bazaar import), pyflakes will spot code like:
def foo(bar):
baz = bar + 2
return 12
and generate a warning like:
example.py:2: local variable 'baz' is assigned to but never used
I use pyflakes hooked up to flymake, so it's always running all the time on every Python file I'm working on. Relying on it has become as second-nature as relying on syntax highlighting. There's a whole class of mistakes I don't make any more, simply because it's on.

However, the main way it helps me is when I'm refactoring code. When extracting a function or changing a variable name, pyflakes acts like a sort of todo list for me. Now that it shows unused local variables, it's getting dangerously close to perfect.

To get pyflakes quickly, bzr branch lp:pyflakes.

(Edit: Grammar fix)

Twitter Updates

Blog Archive