[issue23518] Misplaced diagnostic caret for some SyntaxErrors

2015-02-25 Thread Zachary Ware
Zachary Ware added the comment: The problem is, the interpreter can't know what you meant to do, so it can only point out what it can't compile. We did recently add a special case for print without parentheses, but adding special cases for everything is just not feasible. Besides, where

[issue23518] Misplaced diagnostic caret for some SyntaxErrors

2015-02-25 Thread Zack Weinberg
Zack Weinberg added the comment: In terms of the formal grammar of the language, you are correct. However, the position of the caret should be chosen based *not* on the formal grammar, but on a heuristic estimation of what the most probable mistake actually is. In both of the cases I

[issue23518] Misplaced diagnostic caret for some SyntaxErrors

2015-02-24 Thread Zack Weinberg
New submission from Zack Weinberg: I tripped over a couple of SyntaxError cases where the diagnostic caret is misplaced. While x: File stdin, line 1 While x: ^ SyntaxError: invalid syntax The caret should point to the capital W in 'While'. for x in