On 2020-07-31, Bart <b...@freeuk.com> wrote: > Not sure about the trailing commas on each. It seems Python ignores > trailing commas on tuple constructors, so that the A,B, would be a > 2-tuple, and A+B, would have been a 1-tuple if A+B had been legal.
It's not just tuples, it's lists, sets, dictionaries, etc. It's very useful because it means that when editing source code to add new items or to rearrange items you don't need to worry about the commas. e.g.: animals = { 'cow': 'mammal', 'spider': 'arachnid', 'turtle': 'reptile', } If you want to add a new item to or remove an existing item from the dictionary, you only need to edit one line, and it doesn't matter if that line is in the middle or at the end of the existing entries. -- https://mail.python.org/mailman/listinfo/python-list