I was surprised today to discover that
A = {1,2,3}
and
B = {1,2,3,}
are both valid syntax in MATLAB. I would
It's convenient to allow trailing punctuation in languages if ever the code is going to be generated from other code.
For example, Lua allows trailing commas, so it's easy to generate Lua code.
You don't have to have a special case in the generating code to omit the final comma, you can just print ITEM-THEN-COMMA for each and every item.