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

Guido van Rossum guido at python.org
Tue Apr 30 15:54:51 CEST 2013


Would it also understand line continuations using parentheses ( the more
common style)?

On Tuesday, April 30, 2013, Antoine Pitrou wrote:

> On Mon, 29 Apr 2013 20:40:37 -0400
> Terry Jan Reedy <tjreedy at udel.edu <javascript:;>> wrote:
> > >>
> > >> 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?
> >
> > Very dubious idea, for multiple reasons given on the issue.
> >
> > > It seems this is already tracked in http://bugs.python.org/issue12458
> >
> > For your example, the OP of that issue would replace the line '"error"'
> > with 'assert', which would not be helpful at all. If your statement was
> >
> > assert some_fairly_long_expression_with_calls ==\
> >      something_else, "error"
> >
> > then is would not be clear that backing up would be helpful.
>
> Perhaps you've missed that Giampaolo's suggestion was to print the
> *entire* statement, not just one line chosen at random?
>
> There's one thing this proposal would make more difficult, which is
> machine-processing of tracebacks. Otherwise it does look better to me.
>
> Regards
>
> Antoine.
>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org <javascript:;>
> http://mail.python.org/mailman/listinfo/python-ideas
>


-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130430/fc170975/attachment.html>


More information about the Python-ideas mailing list