def get_callable(key,executor=None):
try:
x = []
if isinstance(key,basestring):
trial(lambda:x.append(evalX(key)),lambda:x.append(None))
return first(a for a in (
key,
x and x[0],
isinstance(key,basestring) and getattr(executor,key,None), #key is a member of executor
getattr(executor,'process',None), #executor is a process object
executor, #executor is a callable
#isinstance(key,basestring) and evalX(key), # key may be name of function
) if a and isCallable(a))
except StopIteration,e:
return None
#@staticmethod
评论列表
文章目录