spulec / pep8ify

A library that modifies python source code to conform to pep8.
Apache License 2.0
118 stars 12 forks source link

Don't insert space after comma for singleton tuples #21

Open tobiasherp opened 10 years ago

tobiasherp commented 10 years ago

Currently pep8ify seems to insert a blank between the comma and the closing bracket of a singleton tuple. I consider this an error. In contradiction to what was written in issue #8, there is a difference between singleton tuples and singleton lists :

>>> tup = (1,)
>>> tup
(1,)
>>> liz = [1,]
>>> liz
[1]

IMO, since the string representation of singleton tuples includes no space before the closing bracket, pep8ify should not insert one. The rule to avoid blanks inside brackets beats the rule to insert a space after commas in this special case.