Tweaks to replace for loops with built-in functions and list comprehensions

svn: r12756
This commit is contained in:
Gerald Britton 2009-07-02 20:01:28 +00:00
parent 5da4aa816d
commit c919910cca
2 changed files with 3 additions and 12 deletions

View File

@ -110,12 +110,7 @@ class EnumeratedListOption(Option):
@type value: The type will depend on the type of option.
@return: nothing
"""
found = False
for (opt_value, opt_description) in self.__items:
if value == opt_value:
found = True
if found:
if any(value == v for v, d in self.__items):
Option.set_value(self, value)
else:
print "Value %s not found for option %s" % ( str(value),

View File

@ -62,14 +62,10 @@ class FilterOption(EnumeratedListOption):
@type filter_list: array
@return: nothing
"""
items = []
curval = self.get_value()
items = [(value, filt.get_name())
for value, filt in enumerate(filter_list)]
value = 0
for filt in filter_list:
items.append((value, filt.get_name()))
value += 1
self.__filters = filter_list
self.clear()
self.set_items( items )