mod_speling for python

Doug Holton no at spam.edu
Fri Jan 30 18:46:52 EST 2004


>> I didn't interpret the OP's question as wanting to automatically map 
>> Foo to
>> foO, but to give the user a more helpful error message, suggesting other
>> candidate names which he might have mistyped.

This can be helpful for beginners especially, to catch not only 
capitalization and minor misspellings, but perhaps other minor errors 
too such as being one space off when indenting, or forgetting a colon.

The python compiler module can check syntax, it just isn't all 
documented.  See this example code:
http://mail.python.org/pipermail/python-dev/2000-September/009501.html
See also the tokenize module:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52298
Or you might go so extreme as metaprogramming and language parsing. See 
PLY: http://systems.cs.uchicago.edu/ply/ and http://gnosis.cx/TPiP/



More information about the Python-list mailing list