I think this is an the territory of linters and style checkers. For now, SyntaxWarning is raised in two cases:
- When we plan to change the language, so in future it be SyntaxError. SyntaxWarning serves a role of less quiet DeprecationWarning (which is hidden by default and often ignored even if seen).
- When we absolutely sure that this syntax construction is never never occurred in normal working code, but it is a common programming error:
assert
with parenthesis as in C, depending on CPython specific interning of literals, missed comma interpreted as a call or subscription.
Python does not raise SyntaxWarning for constructions which can occur in real code. In the linter you have options to control what types of warnings you want to see, and it is expect to use such options. The Python interpreter is used to run Python programs, not to view warnings. If the warning is enabled by default and needs an option to disable, it will harm users of Python programs. If the warning is disabled by default and needs an option to enable, it loses the purpose. The beginner will not use option, because they do not know about it, and the more advanced user can use a linter with the same success.