views:

243

answers:

5

What's the best way to spell check strings and comments inside Python source code?

A: 

The easiest i would say is to use grep or perl to pull out all the data, and then pass it into a spellchecker (ie Word or the "spell" linux command)

mlathe
+1  A: 

You can use PyEnchant for this. It uses the same spell-checking backend that Abiword uses.

Chinmay Kanchi
This isn't a complete solution, but it's the basic direction I took, which seems the most promising.
Chip Tol
+2  A: 

If you are an Emacs user you can add this to your .emacs

(add-hook 'text-mode-hook 'turn-on-flyspell)
(add-hook 'python-mode-hook 'flyspell-prog-mode) 
kriss
+1  A: 

The PyDev plugin for the Eclipse IDE does it.

According to the release history, it was added in version 1.3.11 and it depends on JDT (Java Development Tools).

Craig McQueen
A: 

Use an editor that supports on-the-fly spell-checking. Is it worth your time to run a separate tool to check spelling?

And, probably more importantly, use pylint or pychecker to catch simple mistakes.

The (Eclipse + PyDev + pylint) combination does this well.

monkut