[Python-ideas] async/await in Python
Jim Baker
jim.baker at python.org
Sat Apr 18 18:01:04 CEST 2015
+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.
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.
On Fri, Apr 17, 2015 at 12:58 PM, Yury Selivanov <yselivanov.ml at gmail.com>
wrote:
> Why "async" and "await" keywords
> --------------------------------
>
> async/await is not a new concept in programming languages:
>
> * C# has it since long time ago [5]_;
>
> * proposal to add async/await in ECMAScript 7 [2]_;
> see also Traceur project [9]_;
>
> * Facebook's Hack/HHVM [6]_;
>
> * Google's Dart language [7]_;
>
> * Scala [8]_;
>
> * proposal to add async/await to C++ [10]_;
>
> * and many other less popular languages.
>
> This is a huge benefit, as some users already have experience with
> async/await,
> and because it makes working with many languages in one project easier
> (Python
> with ECMAScript 7 for instance).
>
--
- Jim
jim.baker@{colorado.edu|python.org|rackspace.com|zyasoft.com}
twitter.com/jimbaker
github.com/jimbaker
bitbucket.com/jimbaker
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150418/8f93be62/attachment.html>
More information about the Python-ideas
mailing list