{"action":"created","issue":{"url":"https://api.github.com/repos/python/asyncio/issues/240","labels_url":"https://api.github.com/repos/python/asyncio/issues/240/labels{/name}","comments_url":"https://api.github.com/repos/python/asyncio/issues/240/comments","events_url":"https://api.github.com/repos/python/asyncio/issues/240/events","html_url":"https://github.com/python/asyncio/issues/240","id":71873382,"number":240,"title":"yield from coro() in comprehensions","user":{"login":"ilevkivskyi","id":12005495,"avatar_url":"https://avatars.githubusercontent.com/u/12005495?v=3","gravatar_id":"","url":"https://api.github.com/users/ilevkivskyi","html_url":"https://github.com/ilevkivskyi","followers_url":"https://api.github.com/users/ilevkivskyi/followers","following_url":"https://api.github.com/users/ilevkivskyi/following{/other_user}","gists_url":"https://api.github.com/users/ilevkivskyi/gists{/gist_id}","starred_url":"https://api.github.com/users/ilevkivskyi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ilevkivskyi/subscriptions","organizations_url":"https://api.github.com/users/ilevkivskyi/orgs","repos_url":"https://api.github.com/users/ilevkivskyi/repos","events_url":"https://api.github.com/users/ilevkivskyi/events{/privacy}","received_events_url":"https://api.github.com/users/ilevkivskyi/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-04-29T13:22:29Z","updated_at":"2015-05-24T16:09:07Z","closed_at":"2015-05-24T16:09:07Z","body":"I would like to draw your attention to https://bugs.python.org/issue10544. In short, `yield` and `yield from` are bound inside a comprehension and not to the containing generator. Moreover, `[yield from coro() for i in lst]` is a valid expression outside a function definition. \r\n\r\nThis bug is two years in \"needs patch\" stage, but a patch has never been submitted.\r\n\r\nBefore PEP 3156 this was a rare bug. But now, replacing a `for` loop with a comprehension inside an asyncio coroutine will lead to subtle bugs and confusing behaviour, see for example: http://stackoverflow.com/questions/29334054/why-am-i-getting-different-results-when-using-a-list-comprehension-with-coroutin"},"comment":{"url":"https://api.github.com/repos/python/asyncio/issues/comments/105031352","html_url":"https://github.com/python/asyncio/issues/240#issuecomment-105031352","issue_url":"https://api.github.com/repos/python/asyncio/issues/240","id":105031352,"user":{"login":"asvetlov","id":356399,"avatar_url":"https://avatars.githubusercontent.com/u/356399?v=3","gravatar_id":"","url":"https://api.github.com/users/asvetlov","html_url":"https://github.com/asvetlov","followers_url":"https://api.github.com/users/asvetlov/followers","following_url":"https://api.github.com/users/asvetlov/following{/other_user}","gists_url":"https://api.github.com/users/asvetlov/gists{/gist_id}","starred_url":"https://api.github.com/users/asvetlov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asvetlov/subscriptions","organizations_url":"https://api.github.com/users/asvetlov/orgs","repos_url":"https://api.github.com/users/asvetlov/repos","events_url":"https://api.github.com/users/asvetlov/events{/privacy}","received_events_url":"https://api.github.com/users/asvetlov/received_events","type":"User","site_admin":false},"created_at":"2015-05-24T16:09:07Z","updated_at":"2015-05-24T16:09:07Z","body":"PEP 492 (accepted) proposes new syntax for asynchronous coroutines.\r\n\r\nIt also have a concept for [asynchronous iterators](https://www.python.org/dev/peps/pep-0492/#asynchronous-iterators-and-async-for)\r\n\r\nAsynchronous generators as well as asynchronous comprehensions are subjects to Python 3.6 maybe."}}