wemake-python-styleguide
wemake-python-styleguide copied to clipboard
Enforce consistency with tuple brackets
Rule request
Thesis
There are several cases when brackets for a tuple can be really important:
- Single element tuples:
x,vs(x,)the second one is easier to read and looks like tuple, the first one is tuple-ish enough. - Multiple elements in tuple:
x = 1, 2, 3vsx = (1, 2, 3)I still prefer explicit brackets - Unpacking:
x, y = t()vs(x, y) = t()I like the first one more, because it looks more like a variable assignment. The same applies tofor,with, etc - Returing and yielding:
return x, yvsreturn (x, y)I like the first one more. But, is it consistent with other our rules?
Reasoning
This is consistency rule. It will be checked with libcst.
Related #1068 https://github.com/wemake-services/wemake-python-styleguide/pull/1147
The first one: https://github.com/PyCQA/flake8-commas
I think I've seen remaining as well but can't recall. Should be checked.
Related: (original, ) vs (original,)