Replace lambdas with list comprehensions

svn: r10843
This commit is contained in:
Gerald Britton 2008-07-04 17:27:51 +00:00
parent 7120655439
commit 6037e9fdd4
3 changed files with 8 additions and 9 deletions

View File

@ -1364,7 +1364,7 @@ class GrampsDbBase(Callback):
data = cursor.next()
cursor.close()
slist.sort()
return map(lambda x: x[1], slist)
return [x[1] for x in slist]
else:
return self.all_handles(self.person_map)
return []
@ -1386,8 +1386,7 @@ class GrampsDbBase(Callback):
data = cursor.next()
cursor.close()
slist.sort()
val = map(lambda x: x[1], slist)
return val
return [x[1] for x in slist]
else:
return self.all_handles(self.place_map)
return []

View File

@ -3235,9 +3235,9 @@ def sort_people(db, handle_list):
temp_list = sname_sub.keys()
temp_list.sort(locale.strcoll)
for name in temp_list:
slist = map(lambda x: (sortnames[x], x), sname_sub[name])
slist = [(sortnames[x], x) for x in sname_sub[name]]
slist.sort(lambda x, y: locale.strcoll(x[0], y[0]))
entries = map(lambda x: x[1], slist)
entries = [x[1] for x in slist]
sorted_lists.append((name, entries))
return sorted_lists

View File

@ -129,10 +129,10 @@ class GeneWebWriterOptionBox:
def on_restrict_toggled(self, restrict):
active = restrict.get_active ()
map (lambda x: x.set_sensitive (active),
[self.topDialog.get_widget("living"),
self.topDialog.get_widget("notes"),
self.topDialog.get_widget("sources")])
for x in [self.topDialog.get_widget("living"),
self.topDialog.get_widget("notes"),
self.topDialog.get_widget("sources")]:
x.set_sensitive(active)
def parse_options(self):
self.restrict = self.topDialog.get_widget("restrict").get_active()