[Python-ideas] Adding rule about trailing comma.
INADA Naoki
songofacandy at gmail.com
Tue Mar 31 10:28:31 CEST 2015
On Tue, Mar 31, 2015 at 4:30 PM, Andrew Barnert <abarnert at yahoo.com> wrote:
> On Mar 30, 2015, at 23:35, INADA Naoki <songofacandy at gmail.com> wrote:
>>
>> What about adding rule about trailing comma?
>
> I don't understand the proposed rule from your example. Are you suggesting that a trailing comma be a syntax error unless it's following by a newline?
I'm sorry, I meant about adding rule to PEP 8. Not Python syntax.
> That would explain both "yesses" and the first "no", but then what's wrong with the second "no"? You can always add newlines in the middle of any parenthesized expression; are you suggesting that you shouldn't be allowed to add one at the very end, unless it's immediately following a comma? If so, why?
>
> Also, you seem to realize you're adding a gratuitous inconsistency with one-element tuples. Haven't they been through enough teasing without having to make them even more different?
>
> Most of all, whatever your actual rule is: Why? What's the intended benefit here?
I recently write Go program more than Python.
I feel good about line continuation rule in Go: Some characters
including comma means line continuation.
Benefit of this style is:
1) More consistent
2) No garbage diff just for just adding comma
>
>>
>> Yes:
>>
>> foo(aaa,
>> bbb)
>>
>> or
>>
>> foo(aaa,
>> bbb,
>> )
>>
>> No:
>>
>> foo(aaa,
>> bbb,) # except one-value tuple.
>>
>> or
>>
>> foo(aaa,
>> bbb
>> )
>>
>>
>>
>> --
>> INADA Naoki <songofacandy at gmail.com>
>> _______________________________________________
>> Python-ideas mailing list
>> Python-ideas at python.org
>> https://mail.python.org/mailman/listinfo/python-ideas
>> Code of Conduct: http://python.org/psf/codeofconduct/
--
INADA Naoki <songofacandy at gmail.com>
More information about the Python-ideas
mailing list