[Python-ideas] Async context managers and iterators with tulip
Nick Coghlan
ncoghlan at gmail.com
Sat Dec 22 13:57:40 CET 2012
On Sat, Dec 22, 2012 at 10:26 PM, Laurens Van Houtven <_ at lvh.cc> wrote:
> I can't quite tell by the wording if you consider
> two-languages-for-the-price-of-one a good thing or a bad thing; but I can
> tell you that at least in Twisted, explicit suspension points have been a
> definite boon :) While it may lead to issues in some things (e.g. new users
> using blocking urllib calls in a callback), I find the net result much
> easier to read and reason about.
On balance, I consider it better than offering only greenlet-style
implicit switching (which is effectively equivalent to preemptive
threading, since any function call or operator may suspend the task).
I'm also a lot happier about it since realising that the model of
emitting futures and using "yield from f" where synchronous code would
use "f.result()" helps unify the two worlds.
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Python-ideas
mailing list