
On 2021-03-12 at 11:02:50 -0500, Ned Batchelder <ned@nedbatchelder.com> wrote:
I think the only reason anyone ever used leading commas to begin with was because of languages that didn't allow a final trailing comma. In those worlds, to keep the editing smooth, people moved the commas to the beginning of the line, breaking with every comma-tradition.
Allowing a trailing comma makes historical diffs shorter and easier to read. For exmaple, if I have a multiline list like this: x = [ 1, 2 ] and add a new element to the end, then I end up with the diff including the 2 even though I didn't change the 2. But if I had had a trailing comma, then the diff only shows the new entry. I see a lot of SQL with the commas at the beginnings of the lines (mostly, I think, due to SQL's syntax), but it solves the same problem.
I don't see a reason to make that odd style easier.
I like allowing a trailing comma (for all of the previously stated reasons), but I agree that "we" (except the SQL people!) seem to have settled on trailing delimiters rather than leading delimiters, probably because of the way we write human languages.