Lawrence D'Oliveiro <l...@geek-central.gen.new_zealand> writes: > Not surprising, since the above list has become completely divorced from its > original purpose. Anybody remember what that was? It was supposed to be used > in a loop, as follows: > > for \ > Description, Attr, ColorList \ > in \ > ( > ("normal", "image", MainWindow.ColorsNormalList), > ("highlighted", "highlight", MainWindow.ColorsHighlightedList), > ("selected", "select", MainWindow.ColorsSelectedList), > ) \ > : > ... > #end for > > Does this make more sense now?
Ugh, no! for descr, attr, colours in [ ('normal', 'image', 'Normal'), ('highlighted', 'highlight', 'Highlighted'), ('selected', 'select', 'Selected')]: colourlist = getattr(MainWindow, 'Colors%sList' % colours) ## ... To be honest, there's so much regularity in that table that I'd consider generating it from a shorter list. This would obviously involve refactoring something else to eliminate the image/normal asymmetry. I'd also consider making the ColorsMumbleList attribute collection into a dictionary. Note that my columns are aligned to 8-column tab stops for easy maintenance (although my editor has used physical spaces rather than tabs). -- [mdw] -- http://mail.python.org/mailman/listinfo/python-list