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:
@ -143,8 +143,7 @@ class DeepRelationshipPathBetween(Rule):
|
||||
progress = None
|
||||
|
||||
self.__matches = set()
|
||||
for path in paths:
|
||||
self.__matches.update(path)
|
||||
map(self.__matches.update, paths)
|
||||
|
||||
def reset(self):
|
||||
self.__matches = set()
|
||||
|
@ -94,8 +94,8 @@ class PersonSidebarFilter(SidebarFilter):
|
||||
|
||||
self.filter_note = gtk.Entry()
|
||||
self.filter_gender = gtk.combo_box_new_text()
|
||||
for i in [ _('any'), _('male'), _('female'), _('unknown') ]:
|
||||
self.filter_gender.append_text(i)
|
||||
map(self.filter_gender.append_text,
|
||||
[ _('any'), _('male'), _('female'), _('unknown') ])
|
||||
self.filter_gender.set_active(0)
|
||||
|
||||
self.filter_regex = gtk.CheckButton(_('Use regular expressions'))
|
||||
|
Reference in New Issue
Block a user