pycodestyle
pycodestyle copied to clipboard
E231: for 1-sized tuple in bracket
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).