<story><title>Async I/O for Python 3 </title><url>https://www.dropbox.com/s/xknbe58zcvjhzhv/PyCon2013.pptx</url></story><parent_chain><item><author>hosay123</author><text>Sane is in the eye of the beholder.. gevent &lt;i&gt;looks&lt;/i&gt; nice, but I&apos;d be very diffident when it comes to actually supporting it in production. It monkey patches the standard library and messes with CPython internals to achieve what it does, infinitely increasing the chance it will conflict with some other piece of code (for example, that bizarre ancient internal propriety library you&apos;re using that started life in Fortran, etc)&lt;p&gt;In the case of async I&apos;m glad to see a from scratch implementation for the standard library. It&apos;s a weird area that necessitates some constructions that there is no really standard Python style for. You only need to look at Twisted and e.g. its method chaining to realize this stuff would need a thorough sanity rework before it ever became standard anyway.&lt;p&gt;Also, most other implementations take the approach of building their own little world. This is definitely true of Twisted. You write code for Twisted, not for Python. Gevent at least doesn&apos;t suffer from this.</text></item><item><author>rdtsc</author><text>Sigh, another Async framework.&lt;p&gt;Yes it has nice features such can replace the reactor/hub thing. Has futures/promises/deferreds. That has all been done before in Twisted. Yields are cute and there was monocle, I wouldn&apos;t say it exactly took off : &lt;a href=&quot;https://github.com/saucelabs/monocle&quot; rel=&quot;nofollow&quot;&gt;https://github.com/saucelabs/monocle&lt;/a&gt;&lt;p&gt;Twisted has inlineCallbacks that use yields as well. Just import Twisted into stdlib then and use that.&lt;p&gt;I am surprised that gevent was dismissed. Ok, there is also eventlet, if someone doesn&apos;t like gevent. Monkey patching is scary? Is it really _that_ scary? Most sane and portable IO code probably runs on that today. Why? Because there is no need to create a parallel world of libraries. Write a test does it pass? Does it handle your use case? I&apos;ll take not knowing if my green threads switch tasks and add another green thread lock, instead of doubling my code size with yields, callbacks and futures.&lt;p&gt;Let&apos;s talk about Twisted (sorry couldn&apos;t resist WAT video reference). I remember for years searching for parallel libraries to parse exotic protocols. Regular Python library is there, but no, can&apos;t use that, sorry. Gotta go find or write one that returns Deferreds. You add a single Twisted module in your code, good luck! -- it ripples all the way to the top through your API and you are doomed being locked into the Twisted world forever.&lt;p&gt;When gevent and eventlet came around it was like a breath of fresh air. This is what sane concurrent IO looks like in Python:&lt;p&gt;&lt;a href=&quot;http://eventlet.net/doc/examples.html&quot; rel=&quot;nofollow&quot;&gt;http://eventlet.net/doc/examples.html&lt;/a&gt;&lt;p&gt;My fear is that many will just say fuck it, I&apos;ll just use Go/Rust/Erlang for IO bound concurrent problems.&lt;p&gt;It is nice having a benevolent dictator, except when he goes a little crazy, then dictatorship doesn&apos;t sounds so much fun anymore.</text></item></parent_chain><comment><author>rdw</author><text>As someone who&apos;s contributed to Eventlet, I&apos;ve always felt that the only way that it could get over this scary hurdle (and it is legitimately scary) is for it to be integrated within Python itself.  Almost all of the weird problems come from fighting with the baked-in assumptions of the Python runtime.  Eventlet does try to alleviate the scariness a little bit by allowing you to import &quot;greened&quot; modules rather than changing the global versions, but that has its own problems.&lt;p&gt;If it were integrated with Python, there would be no monkeypatching, no special magic, it would be just how things work.  That said, I&apos;m not at all surprised that Guido doesn&apos;t favor a coroutine-based solution; his opposition to general coroutines is as famous as his opposition to anonymous functions.  (to clarify: I don&apos;t think the @coroutine decorator creates &quot;real&quot; coroutines, any more than generators were already coroutines)</text></comment>
<story><title>Async I/O for Python 3 </title><url>https://www.dropbox.com/s/xknbe58zcvjhzhv/PyCon2013.pptx</url></story><parent_chain><item><author>hosay123</author><text>Sane is in the eye of the beholder.. gevent &lt;i&gt;looks&lt;/i&gt; nice, but I&apos;d be very diffident when it comes to actually supporting it in production. It monkey patches the standard library and messes with CPython internals to achieve what it does, infinitely increasing the chance it will conflict with some other piece of code (for example, that bizarre ancient internal propriety library you&apos;re using that started life in Fortran, etc)&lt;p&gt;In the case of async I&apos;m glad to see a from scratch implementation for the standard library. It&apos;s a weird area that necessitates some constructions that there is no really standard Python style for. You only need to look at Twisted and e.g. its method chaining to realize this stuff would need a thorough sanity rework before it ever became standard anyway.&lt;p&gt;Also, most other implementations take the approach of building their own little world. This is definitely true of Twisted. You write code for Twisted, not for Python. Gevent at least doesn&apos;t suffer from this.</text></item><item><author>rdtsc</author><text>Sigh, another Async framework.&lt;p&gt;Yes it has nice features such can replace the reactor/hub thing. Has futures/promises/deferreds. That has all been done before in Twisted. Yields are cute and there was monocle, I wouldn&apos;t say it exactly took off : &lt;a href=&quot;https://github.com/saucelabs/monocle&quot; rel=&quot;nofollow&quot;&gt;https://github.com/saucelabs/monocle&lt;/a&gt;&lt;p&gt;Twisted has inlineCallbacks that use yields as well. Just import Twisted into stdlib then and use that.&lt;p&gt;I am surprised that gevent was dismissed. Ok, there is also eventlet, if someone doesn&apos;t like gevent. Monkey patching is scary? Is it really _that_ scary? Most sane and portable IO code probably runs on that today. Why? Because there is no need to create a parallel world of libraries. Write a test does it pass? Does it handle your use case? I&apos;ll take not knowing if my green threads switch tasks and add another green thread lock, instead of doubling my code size with yields, callbacks and futures.&lt;p&gt;Let&apos;s talk about Twisted (sorry couldn&apos;t resist WAT video reference). I remember for years searching for parallel libraries to parse exotic protocols. Regular Python library is there, but no, can&apos;t use that, sorry. Gotta go find or write one that returns Deferreds. You add a single Twisted module in your code, good luck! -- it ripples all the way to the top through your API and you are doomed being locked into the Twisted world forever.&lt;p&gt;When gevent and eventlet came around it was like a breath of fresh air. This is what sane concurrent IO looks like in Python:&lt;p&gt;&lt;a href=&quot;http://eventlet.net/doc/examples.html&quot; rel=&quot;nofollow&quot;&gt;http://eventlet.net/doc/examples.html&lt;/a&gt;&lt;p&gt;My fear is that many will just say fuck it, I&apos;ll just use Go/Rust/Erlang for IO bound concurrent problems.&lt;p&gt;It is nice having a benevolent dictator, except when he goes a little crazy, then dictatorship doesn&apos;t sounds so much fun anymore.</text></item></parent_chain><comment><author>RyanGWU82</author><text>My company used gevent in production at very large scale, and we were extremely happy with it. In fact, we ported our existing Django and Flask applications to run under gevent, which was a surprisingly fast process. (Weeks, not months, to port rather large codebases.) We did have to be careful with third-party libraries, like Zookeeper clients, but that was worth the tradeoff. We got the performance of an evented structure without having to rewrite a ton of code.</text></comment>