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.

Author terry.reedy
Recipients CuriousLearner, ammar2, aroberge, brandtbucher, corona10, eric.smith, iritkatriel, lys.nikolaou, miss-islington, ncoghlan, nitishch, pablogsal, piyushhajare, serhiy.storchaka, terry.reedy, veky, xtreak
Date 2021-08-10.19:18:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I think that this was properly closed after the last fix.  There are multiple issues at play:

1. These parts of the Zen:
"Special cases aren't special enough to break the rules.
Although practicality beats purity.
In the face of ambiguity, refuse the temptation to guess."

2. The fact that a parser only reads and checks *python* syntax, while we humans have to make a special effort to avoid semantics.  The latter is especially true when the semantic is a special-case computing trope. Even if an identifier is semantically recognized as a function, its signature (call syntax) is specific to the function and is not part of python syntax.

3. The that with PEG parsing, there is no exact failure point. (Pablo just documented the PEG parser.  But, Pablo, where is it?  Not in HOWTO or index.)  This is especially true when there are multiple errors, as in Andre's example.

As long as we only had one special case hint, which depended on the semantic knowledge that 'print' is almost certainly meant to mean print with the builtin function with a known call syntax, it was fairly easy to get the hint right, and in 3.11 we still have

>>> print """jsfl sf
... sjflsfj l
... sjflsjf
... sjfs fj
... sjlsfjlsjg
... """
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?

But we now have more hints, and "print Hello world!" is syntactically the same as "a b c!", which gives the same error message.  Even if the first identifier is recognized as a function, and parenthesis are added, the result would be syntactically identical to "print(b c!)".  At this  point, it is syntactically ambiguous whether the fixed argument should be a string "'b c!'" or comma list "b, c".  Both are possible for print, but not all functions.  The 'correct' fix on only 'obvious' when we add knowledge of the semantics 'Hello, 'world', and '!' and the history of their concatenation, 'Hello world!' (but sometimes without '!' or capitalization, or with <name> replacing 'world'), in computing, and especially in the teaching of beginners in a particular language.
Date User Action Args
2021-08-10 19:18:12terry.reedysetrecipients: + terry.reedy, ncoghlan, eric.smith, aroberge, serhiy.storchaka, veky, ammar2, CuriousLearner, corona10, lys.nikolaou, nitishch, pablogsal, miss-islington, xtreak, piyushhajare, brandtbucher, iritkatriel
2021-08-10 19:18:12terry.reedysetmessageid: <>
2021-08-10 19:18:12terry.reedylinkissue34013 messages
2021-08-10 19:18:12terry.reedycreate