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:
@@ -74,10 +74,10 @@ class PluginManagerGramplet(Gramplet):
|
||||
row.append(line[1:].strip())
|
||||
else:
|
||||
state = "read"
|
||||
types = {}
|
||||
for row in rows:
|
||||
types[row[1]] = 1
|
||||
|
||||
types = dict([row[1], 1] for row in rows)
|
||||
self.set_text("")
|
||||
|
||||
# name, type, ver, desc, use, rating, contact, download
|
||||
for type in types:
|
||||
self.render_text("<b>%s Plugins</b>\n" % _(type))
|
||||
|
Reference in New Issue
Block a user