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.
Hacking, Software Collaboration, Testing and Diverse Other Topics of General Interest to the Practicing Programmer
Tuesday, June 30, 2009
Thursday, June 25, 2009
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:
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)
def foo(bar):and generate a warning like:
baz = bar + 2
return 12
example.py:2: local variable 'baz' is assigned to but never usedI 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)
Subscribe to:
Posts (Atom)
Blog Archive
-
►
2010
(68)
-
►
November
(14)
- testtools manuals
- Tests that print stuff
- Boiling kettles, unit tests and data
- Big or small?
- "Don't Make Me Think", thoughts for Launchpad
- Reviewing specs, rock on!
- Having an extra feature never hurts, rebutted
- And then what?
- Make it really easy to fix bugs on Ubuntu
- What else have you got?
- Ubuntu in a VM on OS X?
- Still going
- What to do, what to do
- Launchpad and UDS-N
-
►
November
(14)
