
On Fri, 12 Mar 2021 at 13:22, roland.puntaier--- via Python-ideas <python-ideas@python.org> wrote:
I had posted this as https://github.com/python/peps/issues/1867 The discussion so far is below.
Please make some arguments.
The major point to me is, that the symmetry is broken, which leads to extra editing actions, like removing the comma in the first line. I guess, this was the reason to allow the comma after the last line/entry: `[1,2,]`. ``[,1,2]`` should also be allowed, too.
This layout style is not something I've ever seen used in "real life", and I don't think it's something that should be encouraged, much less added to the language.
But the comma is just a separator. Why did they allow to have the comma before a closing bracket/parenthesis/brace? Because of symmetry between lines, is my guess.
More likely because there are two common schools of thought - lists have punctuation *separating* items, and lists have punctuation *terminating* items. I don't even know a commonly used term for the idea of having something *before* each item. So I think you need to find examples of other languages that support this style if you want to advocate for it, otherwise you'll need to demonstrate that it's important enough for Python to go against the norm here.
I personally also have a macro in the editor that evaluates a line in the parameter list, but drops an initial comma before doing that. Therefore this is my preferred formatting.
But (1) "it's my preference" isn't sufficient to change the language, and (2) why not change your macro to remove a *trailing* comma instead? Overall, I don't think this is a good idea. -1 from me. Paul