[Python-Dev] A grammatical oddity: trailing commas in argument lists -- continuation (original) (raw)

Glenn Linderman v+python at g.nevcal.com
Mon Dec 13 21:08:31 CET 2010


On 12/13/2010 11:39 AM, Mark Dickinson wrote:

mything = Thing( foo = Foo(arg1, arg2, ...), bar = Bar(arg3, arg4, ...), ... )

and I've found the trailing comma very convenient during refactoring and API experimentation. (There's still good fun to be had arguing about the indentation of that closing parenthesis, though.)

Clearly it needs to be indented one level, because it is a continuation of the prior line, just like the foo and bar and ... lines are continuations and therefore indented.

I'd have argued differently for languages that use {} to delimit blocks.

Enjoy!



More information about the Python-Dev mailing list