This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Inconsistent grammar in new error message (introduced in 3.10.0a7)
Type: Stage: resolved
Components: Interpreter Core Versions: Python 3.10
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: aroberge, gvanrossum, lys.nikolaou, pablogsal, serhiy.storchaka
Priority: normal Keywords:

Created on 2021-04-06 12:24 by aroberge, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (5)
msg390323 - (view) Author: Andre Roberge (aroberge) * Date: 2021-04-06 12:24
Python version 3.10.0a7 added a more informative error message for:

>>> f"{**k}"
  File "<stdin>", line 1
    (**k)
     ^
SyntaxError: f-string: can't use double starred expression here

Previously, the message was simply "SyntaxError: invalid syntax".  So, this change is certainly a welcome addition.

However, as far as I can tell, starting with Python 3.8, all previous uses of "can't" in error messages were replaced by "cannot".  Although it is an extremely minor point, it might be preferable for consistency to replace "can't" by "cannot" in this new error message.
msg390334 - (view) Author: Lysandros Nikolaou (lys.nikolaou) * (Python committer) Date: 2021-04-06 14:02
We can change the wording to `cannot` in order for all of the error messages to be consistent. Would you like to propose a PR, Andre?
msg390335 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2021-04-06 14:04
Not all "can't" in error messages were replaced by "cannot".

$ find Parser Python Objects Modules -name '*.[ch]' | xargs egrep '".*[Cc]an'\''t.*"' | wc -l
181
$ find Parser Python Objects Modules -name '*.[ch]' | xargs egrep '".*[Cc]annot.*"' | wc -l
247

$ find Lib -name '*.py' | xargs egrep '(["'\'']).*[Cc]an'\''t.*\1' | wc -l
239
$ find Lib -name '*.py' | xargs egrep '(["'\'']).*[Cc]annot.*\1' | wc -l
602

$ find Doc -name '*.rst' | xargs egrep '[Cc]an'\''t' | wc -l
180
$ find Doc -name '*.rst' | xargs egrep '[Cc]annot' | wc -l
482
msg390338 - (view) Author: Andre Roberge (aroberge) * Date: 2021-04-06 14:17
Since all the messages I track so far (https://github.com/aroberge/friendly/blob/master/friendly/syntax_errors/message_analyzer.py) had been changed when going from 6.7 to 3.8, I had (incorrectly) assumed that all such error messages been changed to use cannot instead of can't.  However, based on Serhyi's search, I gather that this is not the case and this specific issue can probably be closed as being irrelevant.
msg390352 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2021-04-06 16:38
Yeah, I do not think anyone cares. :-)
History
Date User Action Args
2022-04-11 14:59:43adminsetgithub: 87914
2021-04-06 16:38:14gvanrossumsetstatus: open -> closed
resolution: wont fix
messages: + msg390352

stage: resolved
2021-04-06 14:17:41arobergesetmessages: + msg390338
2021-04-06 14:04:26serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg390335
2021-04-06 14:02:56lys.nikolaousetmessages: + msg390334
2021-04-06 13:42:23xtreaksetnosy: + gvanrossum, lys.nikolaou, pablogsal
2021-04-06 12:24:08arobergecreate