[Python-ideas] async/await in Python
Yury Selivanov
yselivanov.ml at gmail.com
Sat Apr 18 19:28:47 CEST 2015
Hi Jim,
On 2015-04-18 12:01 PM, Jim Baker wrote:
> +1
>
> Such support would make async coroutines work well on implementations like
> Jython, as opposed to the current situation that there's a large body of
> current async code, using the greenlet approach, that currently does not.
This is so great to hear! Thank you for bringing this up!
>
> Note that efficient support would currently require linking a jar from
> https://github.com/puniverse/quasar, but there's also the possibility that
> will be in a future Java as well (it's certainly discussed at most JVM
> Language Summits).
>
> Compare this proposal to what we have with greenlet and its use of a
> function named "switch", which cannot be statically determined to be such a
> thing. Without the static determination we get with keyword support, we
> cannot mark code as being a coroutine for Quasar, so it must be assumed to
> be so, at extra runtime overhead; also such support also would require that
> *all* Python code runs as Python bytecode (with the extra overhead that
> entails of running a Python bytecode VM on the JVM) since it could possibly
> be asynchronous.
>
> The alternative is to map such async coroutines to threads, much as I did
> for greenlet support with this proof-of-concept
> https://github.com/jythontools/artificialturf Although one can potentially
> run 1000s and possibly 10000s of threads on a JVM on say Linux, this is
> certainly not the case for all OS targets.
>
>
Best,
Yury
More information about the Python-ideas
mailing list