Allowing comments after the line continuation backslash

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Wed Nov 10 07:26:50 CET 2010


In message <mailman.793.1289347547.2218.python-list at python.org>, Robert Kern 
wrote:

> For me, putting the brackets on their own lines (and using a trailing
> comma) has little to do with increasing readability. It's for making
> editing easier. Keeping all of the items consistent means that in order to
> add, delete, or move any item is the same operation everywhere in the list
> whether it is the first item, last item, or any item in between.

Yup, I like to do that when there’s nothing special about the last item in 
the list. Sometimes there is (e.g. an enumeration entry naming the number of 
values in the enumeration, or an all-zero sentinel marking the end of a 
list), in which case I omit the comma to indicate that nothing should come 
afterwards.

I remember an early experience with JavaScript (back in the days of Netscape 
versus Internet Explorer 5.1 on a Mac), when I found that constructing a 
list in this way wasn’t working in IE: turned out it was inserting some kind 
of extra phantom list item after that last comma. Sigh...



More information about the Python-list mailing list