Replace __call__ in dir(*) with callable(*) for performance gain

svn: r10856
This commit is contained in:
Gerald Britton 2008-07-14 15:47:15 +00:00
parent dda6988dfc
commit 709c58b4eb
6 changed files with 6 additions and 6 deletions

View File

@ -53,7 +53,7 @@ class UpdateCallback:
@param interval: number of seconds at most between the updates @param interval: number of seconds at most between the updates
@type interval: int @type interval: int
""" """
if '__call__' in dir(callback): # callback is really callable if callable(callback): # callback is really callable
self.update = self.update_real self.update = self.update_real
self.callback = callback self.callback = callback
self.interval = interval self.interval = interval

View File

@ -237,7 +237,7 @@ class CSVWriter:
self.cl = cl self.cl = cl
self.filename = filename self.filename = filename
self.callback = callback self.callback = callback
if '__call__' in dir(self.callback): # callback is really callable if callable(self.callback): # callback is really callable
self.update = self.update_real self.update = self.update_real
else: else:
self.update = self.update_empty self.update = self.update_empty

View File

@ -136,7 +136,7 @@ class CalendarWriter:
self.cl = cl self.cl = cl
self.filename = filename self.filename = filename
self.callback = callback self.callback = callback
if '__call__' in dir(self.callback): # callback is really callable if callable(self.callback): # callback is really callable
self.update = self.update_real self.update = self.update_real
else: else:
self.update = self.update_empty self.update = self.update_empty

View File

@ -133,7 +133,7 @@ class CardWriter:
self.cl = cl self.cl = cl
self.filename = filename self.filename = filename
self.callback = callback self.callback = callback
if '__call__' in dir(self.callback): # callback is really callable if callable(self.callback): # callback is really callable
self.update = self.update_real self.update = self.update_real
else: else:
self.update = self.update_empty self.update = self.update_empty

View File

@ -141,7 +141,7 @@ class FtreeWriter:
self.cl = cl self.cl = cl
self.filename = filename self.filename = filename
self.callback = callback self.callback = callback
if '__call__' in dir(self.callback): # callback is really callable if callable(self.callback): # callback is really callable
self.update = self.update_real self.update = self.update_real
else: else:
self.update = self.update_empty self.update = self.update_empty

View File

@ -162,7 +162,7 @@ class GeneWebWriter:
self.cl = cl self.cl = cl
self.filename = filename self.filename = filename
self.callback = callback self.callback = callback
if '__call__' in dir(self.callback): # callback is really callable if callable(self.callback): # callback is really callable
self.update = self.update_real self.update = self.update_real
else: else:
self.update = self.update_empty self.update = self.update_empty