[Python-ideas] Adding rule about trailing comma.

Andrew Barnert abarnert at yahoo.com
Tue Mar 31 09:30:50 CEST 2015


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? 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?

> 
> 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/


More information about the Python-ideas mailing list