In message <87fwvdb69k.fsf....@metalzone.distorted.org.uk>, Mark Wooding wrote:
> Lawrence D'Oliveiro <l...@geek-central.gen.new_zealand> writes: > >> 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) > ## ... But then you lose the ability to match up the bracketing symbols. That’s why I put them on lines by themselves. > 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. Maybe you should look at the code in context <https://github.com/ldo/dvd_menu_animator>, then you can express some more opinions on how to improve it. -- http://mail.python.org/mailman/listinfo/python-list