tags:

views:

206

answers:

4

Does anyone know of an already-written Python script, tool, or editor that will check for unbalanced multi-line tokens? (parentheses, quotes, {}, [], etc.)

I've been writing Python code in IDLE, and every so often I'll get "EOF token in multi-line statement" and start swearing, because it means that somewhere in about 200 lines of code I forgot a closing parenthesis or quote and IDLE can't tell me where. This seems like a fairly straightforward thing, I just don't really have the time or headspace to work it out myself right now.

Much thanks

A: 

I use Eclipse with PyDev. It's very good for this sort of thing, and lots more.

danben
Links are yay. Thanks, I'll check these out.
Rowan
+1  A: 

emacs will automatically highlight matching pairs of parentheses/brackets/quotes/etc. as you type them, and it will inform you immediately if you mismatch them (e.g. if you type a [ followed by a )). I'm sure vim also does this, but since I don't use vim, I can't say with certainty.

Adam Rosenfield
vim definitely does that. It also allows jumping to the paired element by pressing `%`.
Antony Hatchkins
Augh, I can't help thinking of text-only consoles whenever I think of emacs or vim. I haven't used them since I was a kid.
Rowan
A: 

PyDev is the best IDE to develop in Python. Has this feature and a lot of more.

Pedro Ghilardi
A: 

If you use the vim text editor, there is a syntax highlighter for Python that might be of some help. Vim's python indenting rules also line up a new line with an unmatched open parenthesis from the previous line. That's been my visual cue that something is unbalanced.

Kristo