Trailing comma
Timo Virkkala
a at a.invalid
Tue Oct 21 15:24:42 EDT 2003
Alex Martelli wrote:
> Timo Virkkala wrote:
>>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...
[snip]
> Learning to use different style in SQL is not going to be difficult,
> because it's such a hugely different language from all of these
> anyway. Are you afraid to use a * for multiplication because it may
> confuse you to write 'select * from ...'?-)
Touché. =)
> Plus, there are errors which are either diagnosed by the computer
> or innocuous (extra commas are typically that way), and others which
> are NOT diagnosed and can be terribly dangerous (missing commas may be).
> E.g., consider:
>
> x = [
> "fee",
> "fie"
> "foo",
> "fum"
> ]
A good example. I didn't spot that on the first look.
Maybe I should get into the habit of always including the trailing comma
and see where I get. Before this I didn't even know that it was allowed.
--
Timo Virkkala
More information about the Python-list
mailing list