Allowing comments after the line continuation backslash

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Tue Nov 2 19:11:52 EDT 2010


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.

Here’s another example for you to chew on:

    for \
        name, reg, doindir \
    in \
        (
            ("R0", 0, True),
            ("R1", 1, True),
            ("R2", 2, True),
            ("R3", 3, True),
            ("R4", 4, True),
            ("R5", 5, True),
            ("R6", 6, True),
            ("SP", 6, True),
            ("R7", 7, False),
            ("PC", 7, False),
        ) \
    :
        ...
    #end for




More information about the Python-list mailing list