[Python-ideas] Async API
sam-pydeas at rushing.nightmare.com
Wed Oct 24 01:00:30 CEST 2012
On 10/23/12 3:05 PM, Yury Selivanov wrote:
> BTW, kudos for shrapnel!
> For basic library functions that will work. And that's already a huge win.
> But developing a complicated library will become twice as hard, as you'll need
> to maintain two versions of API - sync & async all the way through the code.
This is really difficult, if you want to see a great example of trying
to make all parties happy, look at Pika (an AMQP implementation).
Actually this reminds me, it would be really great if there was a
standardized with_timeout()API. It's better than adding timeout args to
all the functions. I'm sure that systems like Twisted & gevent could
also implement it (if they don't already have it):
In shrapnel it is simply:
coro.with_timeout (<seconds>, <fun>, *args, **kwargs)
Timeouts are caught thus:
> There is only one way to 'magically' make existing code both sync- & async-
> friendly--greenlets, but I think there is no chance for them (or stackless) to
> land in cpython in the foreseeable future (although it would be awesome.)
> BTW, why didn't you use greenlets in shrapnel and ended up with your own
I think shrapnel predates greenlets... some of the core asm code for
greenlets may have come from one of shrapnel's precursors at ironport...
Unfortunately it took many years to get shrapnel open-sourced - I
remember talking with Guido about it over lunch in ~2006.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 194 bytes
Desc: OpenPGP digital signature
More information about the Python-ideas