存储延迟回调的函数和方法
CallQueue的Python项目详细描述
调用队列提供一个MIXIN类来存储函数、方法或任何可调用对象 具有关联的参数和关键字参数。
每个可查询对象都有一个键,因此可以根据需要分隔队列
可直接使用:
#!/usr/bin/env python from queueable import Queueable Arthur = Queueable('human') Trillian = Queuable('human') Ford = Queuable('alien') Zaphod = Queueable('alien') def drink_tea(response): print "This stuff {}".format(response) Arthur.queue(drink_tea, "tastes filthy") # Nothing happens Ford.process_queue() # Nothing happens Trillian.process_queue() # runs the queued drink_tea function