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

Guido van Rossum guido at python.org
Mon Dec 13 17:54:16 CET 2010


On Mon, Dec 13, 2010 at 5:42 AM, Tres Seaver <tseaver at palladion.com> wrote:

I actually make use of the feature when dealing with APIs which both a) take lots of arguments (more than fit comfortably on two lines at whatever indentation they are called), and b) have optional trailing arguments:  I always leave the trailing comma in place in such cases, with the closing paren on the following line, so that adding or removing an argument at the end of the list stays consistent (the diffs are better, too, when I use this pattern).

Same here, and it's a soft style rule at Google that trailing commas are good -- they can help produce shorter diffs. I'm at least +0 on allowing trailing commas in the situation the OP mentioned.

-- --Guido van Rossum (python.org/~guido)



More information about the Python-Dev mailing list