Sometimes many levels of trace messages can be helpful when detecting bugs, 
however, in the case of NameErrors,  these "nuggets" ejected from deep within 
the bowls of the Python interpreter are nothing more than steaming piles of 
incomprehensible crap!

We don't need multiple layers of traces for NameErrors. Python does not have 
*real* global variables; and thank Guido for that! All we need to know is which 
module the error occurred in AND which line of that module contains the 
offensive lookup of a name that does not exist.

============================================================
 Here is a fine example
============================================================

------------------------------
 Contents of mod1.py
------------------------------
print symbolNonExistant

------------------------------
 Contents of mod2.py
------------------------------
import mod1

------------------------------
 Contents of mod3.py
------------------------------
import mod2

============================================================
 Results of executing mod3.py
============================================================
Traceback (most recent call last):
  File "C:/a/b/c/mod3.py", line 2, in <module>
    import mod2
  File "C:/a/b/c/mod2.py", line 1, in <module>
    import mod1
  File "C:/a/b/c/mod1.py", line 2, in <module>
    print symbolNonExistant
NameError: name 'symbolNonExistant' is not defined

Why did i need to see all that junk when all i really need to see was this:

Traceback (most recent call last):
  File "C:/a/b/c/mod1.py", line 2, in <module>
    print symbolNonExistant
NameError: name 'symbolNonExistant' is not defined

Or event better:

NameError: name 'symbolNonExistant' is not defined
  File "C:/a/b/c/mod1.py", line 2, in <module>
    print symbolNonExistant
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to