python-novice-inflammation icon indicating copy to clipboard operation
python-novice-inflammation copied to clipboard

Mention in setup instructions that Python 3.10 has significantly improved error messages

Open namurphy opened this issue 4 years ago • 1 comments

Python 3.10, which is due to be released in October 2021, will have significantly improved error messages for common syntax errors. Here's one of the examples they give:

File "example.py", line 1
    expected = {9: 1, 18: 2, 19: 2, 27: 3, 28: 3, 29: 3, 36: 4, 37: 4,
               ^
SyntaxError: '{' was never closed

Up through Python 3.9, the error points to the subsequent line which can make it harder to understand and find the error. Using Python 3.10 in this lesson would be extremely helpful for the participants to track down errors (especially since unclosed parentheses are really common.

I've been thinking that a note in the setup instructions that gently suggests Python ≥ 3.10 would be worthwhile due to the improved error messages. The note probably shouldn't be included until Python 3.10 has been out for a few months (i.e. ≳ Feb 2022) since it can take some time for packages to be fully supported. I'd also make it clear that 3.10 is not required and that the only noticeable difference will be the significantly improved error messages. The downside of my suggestion is that it'll add some complications to the setup, but the upside is that it'll reduce the frustration associated with debugging common syntax errors.

namurphy avatar Jun 23 '21 14:06 namurphy

I think once Python 3.10 is the default download on the Anaconda site (since that is the version we recommend learners download in the setup), this might be a useful tip to include. Thanks for pointing out this error message change @namurphy !

ldko avatar Jun 24 '21 16:06 ldko