wemake-python-styleguide icon indicating copy to clipboard operation
wemake-python-styleguide copied to clipboard

Enforce consistency with tuple brackets

Open sobolevn opened this issue 4 years ago • 2 comments

Rule request

Thesis

There are several cases when brackets for a tuple can be really important:

  1. Single element tuples: x, vs (x,) the second one is easier to read and looks like tuple, the first one is tuple-ish enough.
  2. Multiple elements in tuple: x = 1, 2, 3 vs x = (1, 2, 3) I still prefer explicit brackets
  3. 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 to for, with, etc
  4. Returing and yielding: return x, y vs return (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

sobolevn avatar Mar 25 '20 08:03 sobolevn

The first one: https://github.com/PyCQA/flake8-commas

I think I've seen remaining as well but can't recall. Should be checked.

orsinium avatar Mar 25 '20 10:03 orsinium

Related: (original, ) vs (original,)

sobolevn avatar Mar 26 '20 14:03 sobolevn