Use built-in functions to replace for loops:

Old code:

for x in y:
  f(x)

New Code:

map(f, y)

Also use defaultdict instead of simple dict when advantageous and use list comprehensions
instead of for loops where map() could be used but requires lambdas.


svn: r14135
This commit is contained in:
Gerald Britton
2010-01-25 17:45:21 +00:00
parent fbb8fa2a52
commit 8f0582df8a
49 changed files with 125 additions and 188 deletions

@@ -405,10 +405,8 @@ class RelationshipView(NavigationView):
#reset the connects
self._change_db(db)
if self.child:
for old_child in self.vbox.get_children():
self.vbox.remove(old_child)
for old_child in self.header.get_children():
self.header.remove(old_child)
map(self.vbox.remove, self.vbox.get_children())
map(self.header.remove, self.header.get_children())
self.child = None
self.bookmarks.update_bookmarks(db.get_bookmarks())
if self.active:
@@ -547,9 +545,7 @@ class RelationshipView(NavigationView):
def write_title(self, person):
for old_child in self.header.get_children():
self.header.remove(old_child)
map(self.header.remove, self.header.get_children())
table = gtk.Table(2, 3)
table.set_col_spacings(12)
table.set_row_spacings(0)