ALAN GAULD wrote:

But that will check the whole file. The OP only wanted to spell
check the comments. Unless I'm missing something?

"Allen Fowler" <allen.fow...@yahoo.com> wrote Are there any utilities to help "spell check" source code? (Docstrings, etc)

I came up with this;
[sample file]
#!/usr/bin/python

def doc_test():
    """Do notheing, but document it.

    No, really, it doesn't do anything.
    """
    pass
[test program]
#!/usr/bin/python
from doc_function_test import doc_test
from enchant.checker import SpellChecker

doc_string = doc_test.__doc__
doc_string = str(doc_string)
chkr = SpellChecker("en_US")
chkr.set_text(doc_string)
for err in chkr:
    print "Error:", err.word

[results]
python spell_check_doc.py
Error: notheing




--
Powered by Gentoo GNU/Linux
http://linuxcrazy.com
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to