Avoid accidental tuples

A comma after a value turns it into tuple. Probably not what you intended to do.

As far as the Python parser is concerned the parentheses are optional for non-empty tuples. According to the documentation: it is actually the comma which makes a tuple, not the parentheses. The parentheses are optional, except in the empty tuple case.

By accidentally suffixing a comma on value = 1, expect to get a TypeError when the code later attempts to perform integer operations on a variable that evaluated to tuple.

If our GitHub code review bot spots this issue in your pull request it gives this advice:

code-review-doctorbotsuggested changes just now
utils.py
1
+
title = 'Hello world',
Suggested changes
-
title = 'Hello world',
+
title = 'Hello world'
Commit suggestion

A comma after a value turns it into tuple. Probably not what you intended to do.

Read more
Update utils.py
We're your Python code review copilot. Get code improvements right in your pull request with our GitHub code review bot.

Configuring this check

Code Review Doctor will run this check by default. No configuration is needed but the check can be turned on/off using check code probably-meant-not-tuple in your pyproject.toml file.

Read more about configuring Code Review Doctor.