How can I catch misnamed variables?
gordon at panix.com
Fri Feb 10 16:06:58 EST 2012
Recently I was been bitten by some stupid errors in my code, and I'm
wondering if there's a simple way to catch them.
One error was of the form:
.. when I hadn't declared an object named "my_object".
The other error was similar:
x = my_module.CONSTANT
.. when I hadn't imported my_module.
Of course both of these errors were deep inside a long-running function
call, so it took a while for them to crop up.
Is there an automated way to catch errors like these? I'm using the
compileall module to build my program and it does catch some errors
such as incorrect indentation, but not errors like the above.
John Gordon A is for Amy, who fell down the stairs
gordon at panix.com B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"
More information about the Python-list