[Python-ideas] Make traceback messages aware of line continuation

Giampaolo Rodola' g.rodola at gmail.com
Mon Apr 29 19:37:03 CEST 2013


Consider the following:

assert \
    1 == 0, \
        "error"

It will produce:

Traceback (most recent call last):
  File "foo.py", line 3, in <module>
    "error"
AssertionError: error

The information about the statement which produced the exception is lost.
Instead I would expect:

Traceback (most recent call last):
  File "foo.py", line 1, in <module>
    assert \
        1 == 0, \
            "error"
AssertionError: error


Not sure how easy this is to implement but I think it would be a good
enhancement.
Thoughts?


--- Giampaolo
https://code.google.com/p/pyftpdlib/
https://code.google.com/p/psutil/
https://code.google.com/p/pysendfile/



More information about the Python-ideas mailing list