[Python-Dev] A grammatical oddity: trailing commas in argument lists.

Georg Brandl g.brandl at gmx.net
Fri Jul 9 22:42:13 CEST 2010


Am 09.07.2010 22:26, schrieb Mark Dickinson:
> On Fri, Jul 9, 2010 at 8:37 PM, Dino Viehland <dinov at microsoft.com> wrote:
>> Terry wrote:
>>> This violates the important principle that allowed def and call arg
>>> sequences should match to the extent sensible and possible. In this
>>> sense, the SyntaxError is a bug. So I would fix this now for 3.2 and
>>> notify the other implementors.
>>
>> +1 on fixing it - trailing commas are awesome.  I'm always annoyed in
>> C# where I frequently can't use them.  This seems like a bug fix level
>> change that should be easy for the other implementations to fix.
> 
> Thanks for all the feedback.
> 
> If the grammar is changed to allow "def f(*, a,): pass", that still
> leaves some more open questions:  which of the following should be
> valid?
> 
> (1) def f(*args,): pass
> (2) def f(**kwargs,): pass
> (3) def f(*,): pass

IMO all of them (though as you mention, (3) doesn't matter.)

Georg

-- 
Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.



More information about the Python-Dev mailing list