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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Python Async IO Resources

33 点作者 amarsahinovic超过 10 年前

4 条评论

nas超过 10 年前
I&#x27;m in the middle of doing an embedded control system project and I&#x27;m using Python 3.4 to do it. The embedded computer runs Debian Linux on an ARM processor. The Python program interfaces with the following: J1939 (CAN bus) network, dual RS232 serial ports, HTTP over TCP on wireless ethernet (for remote operator&#x27;s panel). The HTTP server is Tornado. Most of the remote interface is done using Javascript.<p>I&#x27;m using Python 3 because I&#x27;m using the new asyncio library designed by Guido. So far, it is working out really well. There was some learning curve to get started but now it is very easy to add new modules to the system. I designed a very lightweight version of an internal message bus, similar to NASA&#x27;s GMSEC. This allows separate modules to communicate without tight coupling between them.<p>The asyncio library doesn&#x27;t have high-level support for socketcan so I had to use some lower level facilities. That took a little research and some digging through the asyncio source. The asynchronous design provides great responsiveness without heavy resource use (CPU or memory). I&#x27;ve done other similar systems using threads or polling but this Python 3 version is more elegant by far.<p>It would have been nicer if the migration path from Python 2 to 3 was smoother. However, after using it for serious work, Python 3 works great. I still wish &#x27;print&#x27; was a keyword or there was some other debugging version of print (e.g. &quot;dump var1, var1&quot;). That&#x27;s not a showstopper though.
ff_超过 10 年前
I discovered asyncio when I stumped on this [1] blog post (linked also at asyncio.org).<p>It was exactly what I needed for a personal project (a fast webscraping thing); before asyncio I went for the threads solution, but this thing performs one thousand times better.<p>I am really optimistic about this library, as the fact that is a core lib will make I&#x2F;O with python A LOT easier.<p>[1]: <a href="http://compiletoi.net/fast-scraping-in-python-with-asyncio.html" rel="nofollow">http:&#x2F;&#x2F;compiletoi.net&#x2F;fast-scraping-in-python-with-asyncio.h...</a>
kenrikm超过 10 年前
I&#x27;ve been using 3.4&#x2F;Asyncio recently and coming from a background of C&#x2F;Objective C it&#x27;s hard to believe Python got by for so long without having something like Asyncio as a core package (yeah I know Gevent and Tornado have been around for awhile) It&#x27;s still new&quot;ish&quot; (summer 2014) so there&#x27;s not a lot of good documentation floating around yet, but it&#x27;s easy enough to get the basics down if you&#x27;ve worked with Async stuff before.
评论 #8738197 未加载
curiously超过 10 年前
I think Greenlets are fantastic but unfortunately worried of performance issues as I&#x27;ve read before. It has all the makings to being a node.js killer. Wish I could find that article explaining why greenlets are sometimes dangerous but I feel like the overall benefit of Greenlets outweigh the risks.
评论 #8741894 未加载