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

View File

@ -140,8 +140,7 @@ class CallbackManager(object):
This method should always be called before a the callback methods
become invalid.
"""
for key in self.custom_signal_keys:
self.database.disconnect(key)
map(self.database.disconnect, self.custom_signal_keys)
self.custom_signal_keys = []
for key, value in self.__callbacks.iteritems():
if not value[1] is None:
@ -186,8 +185,7 @@ class CallbackManager(object):
for key in KEYS:
handles = ahandledict.get(key)
if handles:
for handle in handles:
self.__handles[key].remove(handle)
map(self.__handles[key].remove, handles)
def unregister_all(self):
"""