P
PT
Hi,
I'm not looking to get into a debate about case-sensitive vs.
insensitive programming languages,
but I was looking for suggestions about how it might be possible to
add a hook to the python parser similar to the Apache mod_speling
module (links below). So that for example if there is a NameError
exception, python walks the globals() and locals() to see if it might
be just a minor spelling/capitalization error.
I can see how this might be done for ImportErrors, using ihooks or iu,
but I don't see how to do it for NameErrors. The python compiler
module doesn't seem to be the answer.
I know there are drawbacks, disadvantages, this is "evil", etc. I
only wanted to know what ways there are to add such a hook if it is
possible without altering the C source for python itself.
Possible End-User Solution A:
Simply add an "import spelling" to a python file to enable
spell-checking, sort of like how you use the psyco module (speaking of
which, how many times have you misspelled that).
Possible End-User Solution B:
Create an alternative executable that wraps the python interpreter.
This wrapper may or may not have to use its own source code parser,
like the unreleased mobius-python project.
http://httpd.apache.org/docs/mod/mod_speling.html
http://lxr.webperf.org/source.cgi/modules/mappers/mod_speling.c
http://www.mcmillan-inc.com/importhooks.html
http://www.python.org/doc/current/lib/module-compiler.html
http://sourceforge.net/projects/mobiuspython
I'm not looking to get into a debate about case-sensitive vs.
insensitive programming languages,
but I was looking for suggestions about how it might be possible to
add a hook to the python parser similar to the Apache mod_speling
module (links below). So that for example if there is a NameError
exception, python walks the globals() and locals() to see if it might
be just a minor spelling/capitalization error.
I can see how this might be done for ImportErrors, using ihooks or iu,
but I don't see how to do it for NameErrors. The python compiler
module doesn't seem to be the answer.
I know there are drawbacks, disadvantages, this is "evil", etc. I
only wanted to know what ways there are to add such a hook if it is
possible without altering the C source for python itself.
Possible End-User Solution A:
Simply add an "import spelling" to a python file to enable
spell-checking, sort of like how you use the psyco module (speaking of
which, how many times have you misspelled that).
Possible End-User Solution B:
Create an alternative executable that wraps the python interpreter.
This wrapper may or may not have to use its own source code parser,
like the unreleased mobius-python project.
http://httpd.apache.org/docs/mod/mod_speling.html
http://lxr.webperf.org/source.cgi/modules/mappers/mod_speling.c
http://www.mcmillan-inc.com/importhooks.html
http://www.python.org/doc/current/lib/module-compiler.html
http://sourceforge.net/projects/mobiuspython