Simplify with built-in functions where possible. e.g.
change [x for x in y if x] to filter(None, y) change [f(x) for x in y] to map(f, x) change [x for x in y] to list(y) These changes reduce source code size and complexity and produce some minor performance gains svn: r14104
This commit is contained in:
@@ -683,7 +683,7 @@ class SimpleAccess(object):
|
||||
|
||||
if obj:
|
||||
handles = [ ref.ref for ref in obj.get_source_references() ]
|
||||
return [ self.dbase.get_source_from_handle(h) for h in handles ]
|
||||
return map(self.dbase.get_source_from_handle, handles)
|
||||
else:
|
||||
return []
|
||||
|
||||
|
@@ -100,7 +100,7 @@ class SimpleTable(object):
|
||||
columns.append(col)
|
||||
# end of unicode fix
|
||||
self.__columns = list(copy.copy(columns))
|
||||
self.__sort_vals = [[] for i in range(len(self.__columns))]
|
||||
self.__sort_vals = [[]]*len(self.__columns)
|
||||
|
||||
def set_callback(self, which, callback):
|
||||
"""
|
||||
|
Reference in New Issue
Block a user