pycodestyle icon indicating copy to clipboard operation
pycodestyle copied to clipboard

E231: for 1-sized tuple in bracket

Open remram44 opened this issue 5 years ago • 0 comments

The following code triggers E231:

dct = {}
dct[1, 2] = "value"  # ok
dct[1,] = "value"  # E231
dct[1, ] = "value"  # ok, but doesn't seem right?
# {(1, 2): 'value', (1,): 'value'}

Of course you can add parentheses (dct[(1,)]) but if Python doesn't require it I'm not sure PEP8 should (and if it does, it should probably have a specific error for this).

remram44 avatar May 12 '20 22:05 remram44