Missing trailing comma in tuple

A tuple with only one element must end with a comma. Python won't know it's a tuple without the comma. 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 missing the comma in values = (1) expect to get a TypeError when the code later attempts to perform tuple operations on a variable that evaluated to int.

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

code-review-doctorbotsuggested changes just now
settings.py
1
+
REST_FRAMEWORK = {
2
+
    'DEFAULT_PERMISSION_CLASSES': (
3
+
        'rest_framework.permissions.IsAuthenticated'
Suggested changes
-
        'rest_framework.permissions.IsAuthenticated'
+
        'rest_framework.permissions.IsAuthenticated',
Expand 2 lines ...
Commit suggestion

A tuple with only one element must end with a comma. Python won't know it's a tuple without the comma. Probably not what you intended to do.

Read more
4
+
    )
5
+
}
Update settings.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-tuple in your pyproject.toml file.

Read more about configuring Code Review Doctor.