Allowing comments after the line continuation backslash
Robert Kern
robert.kern at gmail.com
Wed Nov 10 12:02:35 EST 2010
On 11/10/10 12:26 AM, Lawrence D'Oliveiro wrote:
> 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...
It's one of the things that pains me every time I code JavaScript. That and the
lack of tuple unpacking.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Python-list
mailing list