Trailing comma (was: Re: structure in Python)

Timo Virkkala a at a.invalid
Tue Oct 21 09:17:55 EDT 2003


Ben Caradoc-Davies wrote:
>     d = {
>         "A": [1, 5],
>         "B": [6, 7],  # last trailing comma is optional but good style
>     }

Why is it considered good style? I mean, I understand that it's easier 
to later add a new line, but... Most places (SQL comes first to mind, 
since I've just done a lot of work with Python and databases) don't 
accept a trailing comma in a similar situation, so if I get into the 
habit of including the trailing comma, I'll just end up tripping myself 
up a lot.

--
Timo Virkkala





More information about the Python-list mailing list