In Python, leaving a trailing comma, for example, this is of course not a SyntaxError :
In [1]: x = 1 , In [2]: x Out[2]: (1,) In [3]: type(x) Out[3]: tuple
But at the same time, if the trailing comma was placed accidentally, it can be difficult to catch such a βproblemβ, especially for Python newbies.
I think that if we can use PyCharm intelligent code quality control to detect this problem earlier, statically, mypy , pylint or flake8 static code analysis tools.
Or, another idea would be to limit / highlight the creation of one element of tuples implicitly without parentheses. Is it possible?
source share