mod_speling for python

Skip Montanaro skip at pobox.com
Thu Jan 29 10:24:54 EST 2004


    prtk3> ... if there is a NameError exception, python walks the globals()
    prtk3> and locals() to see if it might be just a minor
    prtk3> spelling/capitalization error.

    prtk3> I can see how this might be done for ImportErrors, using ihooks
    prtk3> or iu, but I don't see how to do it for NameErrors. The python
    prtk3> compiler module doesn't seem to be the answer.

    prtk3> I know there are drawbacks, disadvantages, this is "evil", etc.
    prtk3> I only wanted to know what ways there are to add such a hook if
    prtk3> it is possible without altering the C source for python itself.

Take a look at sys.excepthook.  Actual implementation is left as an exercise
for the reader. <wink>

Skip




More information about the Python-list mailing list