In message <[email protected]>, 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
--
http://mail.python.org/mailman/listinfo/python-list