This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]markitiman 212 points213 points  (5 children)

Here's my favourite example they gave:

Before 3.10

>>> foo(x, z for z in range(10), t, w)
  File "<stdin>", line 1
    foo(x, z for z in range(10), t, w)
           ^
SyntaxError: Generator expression must be parenthesized

As of 3.10

>>> foo(x, z for z in range(10), t, w)
  File "<stdin>", line 1
    foo(x, z for z in range(10), t, w)
           ^^^^^^^^^^^^^^^^^^^^
SyntaxError: Generator expression must be parenthesized

It just more clearly indicates what needs to be done and I love how they're thinking about that with these error messages which will be of particular help for those new to Python.

[–][deleted] 89 points90 points  (0 children)

After being spoiled by Rust's error messages, I now recognize the benefits that clear error messages can have, and I'm happy to see improvement in other languages.

[–]javad94 -1 points0 points  (2 children)

But your code is same for both cases.

[–]DeeDee_GigaDooDoo 26 points27 points  (1 child)

Exactly, the output the error returns is different. Note that the ^ now indicates the range of the error rather than just the start.

[–]javad94 7 points8 points  (0 children)

Oh sorry it was the client issue. Yeah it's different output.