{"action":"opened","issue":{"url":"https://api.github.com/repos/ondrejsika/ondrejsika.com/issues/126","labels_url":"https://api.github.com/repos/ondrejsika/ondrejsika.com/issues/126/labels{/name}","comments_url":"https://api.github.com/repos/ondrejsika/ondrejsika.com/issues/126/comments","events_url":"https://api.github.com/repos/ondrejsika/ondrejsika.com/issues/126/events","html_url":"https://github.com/ondrejsika/ondrejsika.com/issues/126","id":71125734,"number":126,"title":"DeferredList","user":{"login":"ondrejsika","id":1665772,"avatar_url":"https://avatars.githubusercontent.com/u/1665772?v=3","gravatar_id":"","url":"https://api.github.com/users/ondrejsika","html_url":"https://github.com/ondrejsika","followers_url":"https://api.github.com/users/ondrejsika/followers","following_url":"https://api.github.com/users/ondrejsika/following{/other_user}","gists_url":"https://api.github.com/users/ondrejsika/gists{/gist_id}","starred_url":"https://api.github.com/users/ondrejsika/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ondrejsika/subscriptions","organizations_url":"https://api.github.com/users/ondrejsika/orgs","repos_url":"https://api.github.com/users/ondrejsika/repos","events_url":"https://api.github.com/users/ondrejsika/events{/privacy}","received_events_url":"https://api.github.com/users/ondrejsika/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ondrejsika/ondrejsika.com/labels/blog%20post","name":"blog post","color":"009800"},{"url":"https://api.github.com/repos/ondrejsika/ondrejsika.com/labels/pythonblog","name":"pythonblog","color":"fbca04"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-04-26T22:01:38Z","updated_at":"2015-04-26T22:01:38Z","closed_at":null,"body":"https://twistedmatrix.com/documents/8.0.0/api/twisted.internet.defer.DeferredList.html\r\n\r\n```\r\nsika@x1:~/tmp/twisted$ cat deffered_list.py \r\nfrom twisted.internet import reactor\r\nfrom twisted.internet.defer import Deferred, DeferredList\r\n\r\ndef p1(res):\r\n    print(1, res)\r\n    return res\r\ndef p2(res):\r\n    print(2, res)\r\n    return res\r\ndef p3(res):\r\n    print(3, res)\r\n    reactor.stop()\r\n    return res\r\n\r\nd = Deferred()\r\nd.addCallback(p1)\r\nd2 = Deferred()\r\nd2.addCallback(p2)\r\n\r\ndl = DeferredList([d, d2])\r\ndl.addCallback(p3)\r\nimport time\r\ntime.sleep(2)\r\nd.callback(1)\r\nd2.callback(2)\r\n\r\nreactor.run()\r\nsika@x1:~/tmp/twisted$ py deffered_list.py \r\n(1, 1)\r\n(2, 2)\r\n(3, [(True, 1), (True, 2)])\r\n```"}}