<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">On Jun 6, 2016, at 12:23 PM, Yury Selivanov <<a href="mailto:yselivanov.ml@gmail.com" class="">yselivanov.ml@gmail.com</a>> wrote:<div><blockquote type="cite" class=""><br class="Apple-interchange-newline"><div class=""><div class="">However, with the current PEP 492 design, the above code would be invalid! The interpreter expects __aiter__ to return a coroutine, not an async generator.<br class=""><br class=""></div></div></blockquote><div><br class=""></div><div>Yes, I remember asking about the reason behind __aiter__ being an awaitable during the original PEP 492 review process. You added an explanation to the PEP but I don’t think we ever had an example where this was needed. I’m +1 to resolve this now.</div><br class=""><blockquote type="cite" class=""><div class=""><div class="">The proposed patch fixes the __aiter__ in a backwards compatible way:<br class=""><br class="">1. ceval/GET_AITER opcode calls the __aiter__ method.<br class=""><br class="">2. If the returned object has an '__anext__' method, GET_AITER silently wraps it in an awaitable, which is equivalent to the following coroutine:<br class=""><br class=""> async def wrapper(aiter_result):<br class=""> return aiter_result<br class=""><br class="">3. If the returned object does not have an '__anext__' method, a DeprecationWarning is raised.<br class=""></div></div></blockquote><div><br class=""></div><div>There’s a problem with this approach. It will force people to write deprecated code because you never know if your library is going to run on 3.5.0 or 3.5.1. Barry, Ubuntu wily, xenial and yakkety currently package 3.5.0 or 3.5.1. When 3.5.2 is going to get released, are they going to get it? I’m pretty sure wily <b class="">isn’t</b> and yakkety <b class="">is</b> but just wanted to confirm; especially with xenial being an LTS release.</div><div><br class=""></div><div>-- </div><div>Not-that-i-see-a-different-way-out’sly yours,</div><div>Ł</div></div></body></html>