相关疑难解决方法(0)

在Python中调用函数列表的惯用方法是什么?

我有一个回调函数列表,我需要在触发事件时调用.这是惯用的蟒蛇吗?

def first_callback(m):
  print 'first ' + m

def second_callback(m):
  print 'second ' + m

lst = [first_callback, second_callback]

map(lambda x: x("event_info"),lst) #is this how you do it?
Run Code Online (Sandbox Code Playgroud)

python

4
推荐指数
1
解决办法
406
查看次数

标签 统计

python ×1