[Python-Dev] Re: 3.11 enhanced error location - can it be smarter?

2022年1月18日 13:46:48 -0800

On 18/01/2022 20:41, Pablo Galindo Salgado wrote:
We cannot base the computation on a % because is possible that the location markers are relevant but the variables, function names or constructs are just very large. I think that the idea of "spawns
the whole line" is sensible, though.
On 2022年1月18日 at 20:32, Steve Dower <[email protected]> wrote:
 Omitting the line of ^ where over x% (75%? 90%?) of characters on the
 line would be marked would be fine by me.
It would also need to take into account cases where a line contains an inline comment, which does not contribute to the code producing the error, but where all of the rest of the line (the code) is the source of the error and highlighting it is not useful
# test.py:
code_that_causes_an_error # a comment
$ python3.11 test.py
Traceback (most recent call last):
 File "test.py", line 1, in <module>
  code_that_causes_an_error # a comment
  ^^^^^^^^^^^^^^^^^^^^^^^^^
NameError: name 'code_that_causes_an_error' is not defined
(the traceback shown is from a current `main` build)
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/F4FSJY7OIPHAH5I6YBHCFI4DP3XLNUJW/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to