TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Python: Generators, Coroutines, Native Coroutines and Async/Await

147 点作者 snw超过 9 年前

4 条评论

mariocesar超过 9 年前
If you don&#x27;t have the latest asyncio version, change `ensure_future` to `async`.<p>&gt; asyncio.async(display_date(1, loop))<p>See this <a href="https:&#x2F;&#x2F;github.com&#x2F;python&#x2F;asyncio&#x2F;pull&#x2F;242" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;python&#x2F;asyncio&#x2F;pull&#x2F;242</a><p>The author is using the latest release of asyncio, will be good to mention that.
harlowja超过 9 年前
Anyone know when most of the python stdlib (the batteries included part) will start itself using async&#x2F;await (for any&#x2F;all things that could block)?? I suppose it will never change due to backwards compat. (which feels odd...)?
评论 #10683533 未加载
评论 #10683152 未加载
评论 #10683847 未加载
评论 #10683735 未加载
bawana超过 9 年前
Async is not new. life has been doing it for millennia. Your heart does not stop beating while you breathe, yet both systems are interrelated. The body accomplishes this through the use of &#x27;buffers&#x27;. Pause one system long enough and the other will fail. So we have evolved a &#x27;scheduler&#x27; - the hindbrain that starts to scream louder and louder when the event queue of one system becomes too long. It might be instructive to model this in silicon. Have one cpu core be the scheduler. Have every set of interrelated processes (that are Async) register their variables with the scheduler. The scheduler then keeps track of these sets. When a variable in a set changes, pause that process for two cycles.
macavity23超过 9 年前
A good article, but it should mention async network programming (probably with <a href="http:&#x2F;&#x2F;www.tornadoweb.org&#x2F;" rel="nofollow">http:&#x2F;&#x2F;www.tornadoweb.org&#x2F;</a>) which is the major driving use case behind the adoption of async programming patterns.