Allowing comments after the line continuation backslash

Roy Smith roy at panix.com
Tue Nov 2 20:17:06 EDT 2010


In article <iaq5ro$vpc$4 at lust.ihug.co.nz>,
 Lawrence D'Oliveiro <ldo at geek-central.gen.new_zealand> wrote:

> In message <roy-A96D07.07462302112010 at news.panix.com>, Roy Smith wrote:
> 
> > In this case, I think I would do:
> > 
> > styles = [("normal",      "image",     MainWindow.ColorsNormalList),
> >           ("highlighted", "highlight", MainWindow.ColorsHighlightedList),
> >           ("selected",    "select",    MainWindow.ColorsSelectedList)]
> > 
> > for in description, attr, color_list in styles:
> >    blah, blah, blah
> 
> And so you have managed to separate one set of looping conditions into two 
> parts. What is the significance of the name “styles”? None at all. What 
> purpose does it serve? None, really. Does it ease the maintenance burden? 
> No, but by splitting your attention across two places, it actually adds to 
> it.

I suppose readability is in the eye of the reader, but, yes, I agree 
that I have split this into two parts.  The parts are

1) The table of data

2) The looping construct

Where we seem to disagree is whether that makes things more or less 
readable :-)  To me, it makes is more readable because it lets me 
understand one chunk, then move on to understanding the next chunk.

You may disagree.  That's OK.



More information about the Python-list mailing list