Trailing comma (was: Re: structure in Python)

Patrick Maupin pmaupin at speakeasy.net
Thu Oct 23 22:53:28 EDT 2003


Cousin Stanley wrote:

>     The style that looks the most natural and seems the easiest
>     to extend and edit to me is .... 
> 
>         x = [ 'fe'  , 
>               'fi'  ,
>               'fo'  , 
>               'fum' ]

Other people have raised some good points as to why using
trailing commas can be better, but for my money the best
reason to consistently use trailing commas is how a CVS
(or other) diff will look later.  You can either see
one deleted line plus two added lines, or a single added
line, your choice.

Pat




More information about the Python-list mailing list