Terry J. Reedy added the comment:

OK, you would make tracebacks even longer by adding lines that might or might 
not be be useful. Suppose the error is not the assertion itself, but in one of 
the expressions (in this case, being compared for equality):
    self.assertEqual(1/0,
        1000)
Or reverse the two expressions, or replace the method call with an assert 
statement and join the expressions with '=='. Would you still print both lines?

My experience on python-list is that people more often have a problem with a 
whole line being too much context, not too little. Someone writes 
'print(complicated_expression)' and gets a Unicode error. Is the problem the 
expression or the printing of the result to a limited charset console? Both 
cases have been posted. I sometimes advise people to break their elegant 
one-liners into two or more lines to make the actual error expression more 
obvious. If we were to revise the CPython compiler and traceback generator, 
that is what I think the aim should be. Such a change would include printing 
multiple lines when the expression spans multiple lines. This might have to be 
limited to debug builds.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue12458>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to