Survey: What co-routine flavor do you prefer in Python?

#1

Hi,

for the fun, here is the result from a mini survey about above question

https://twitter.com/oberstet/status/724705121037369344

Takeaway: 76% of the respondents prefer the latest Python 3.5+ way of doing co-routines!

That is, using the new async/await keywords and syntax introduced with Python 3.5.

This is interesting!

And FWIW, I agree and would have voted the same (can't, since I started the survey).

For writing new _app_ code (that doesn't have legacy or backward compat. requirements) the new way (async/await) is just very nice and clean.

Note: for libraries (like Autobahn) and black-box code (like Crossbar.io), this is different, because there are different goals and requirements here.

Here is how this flavor looks like:

import asyncio

async def slow_operation(n):
     await asyncio.sleep(1)
     print("Slow operation {} complete".format(n))

async def main():
     await asyncio.wait([
         slow_operation(1),
         slow_operation(2),
         slow_operation(3),
     ])

loop = asyncio.get_event_loop()
loop.run_until_complete(main())

http://makina-corpus.com/blog/metier/2015/python-http-server-with-the-new-async-await-syntax

···

---

If you have opinions/feedback about this, that would be really interesting for me.

Personally I think that Python with the new async/await stuff finally has reached the status of first-class, built-in asynchronous programming support.

And I think this cannot be overestimated. It is a big thing. In particular because it will lower the bar doing asynchronous programming in Python and make it approachable to a wider audience.

Other languages are at different stages to similar syntax.

Eg JavaScript: ES7 (ES2016)

Here is a very nice intro

http://rossboucher.com/await/#/

that shows of the progression we've come along from

callbacks (hell) -> promises -> co-routines (async/await)

Well, just my 2cts. What do you think?

Cheers,
/Tobias

Note: we need to update our docs

https://github.com/crossbario/autobahn-python/issues/653

Any help on that would be highly appreciated!

0 Likes

#2

Hi,

I would like to proofread any updated docs and try to provide constructive criticism.

Cheers,

Roger

···

Op donderdag 28 april 2016 08:05:11 UTC+2 schreef Tobias Oberstein:

Hi,

for the fun, here is the result from a mini survey about above question

https://twitter.com/oberstet/status/724705121037369344

Takeaway: 76% of the respondents prefer the latest Python 3.5+ way of
doing co-routines!

That is, using the new async/await keywords and syntax introduced with
Python 3.5.

This is interesting!

And FWIW, I agree and would have voted the same (can’t, since I started
the survey).

For writing new app code (that doesn’t have legacy or backward compat.
requirements) the new way (async/await) is just very nice and clean.

Note: for libraries (like Autobahn) and black-box code (like
Crossbar.io), this is different, because there are different goals and
requirements here.

Here is how this flavor looks like:


import asyncio



async def slow_operation(n):

     await asyncio.sleep(1)

     print("Slow operation {} complete".format(n))





async def main():

     await asyncio.wait([

         slow_operation(1),

         slow_operation(2),

         slow_operation(3),

     ])



loop = asyncio.get_event_loop()

loop.run_until_complete(main())

http://makina-corpus.com/blog/metier/2015/python-http-server-with-the-new-async-await-syntax


If you have opinions/feedback about this, that would be really
interesting for me.

Personally I think that Python with the new async/await stuff finally
has reached the status of first-class, built-in asynchronous programming
support.

And I think this cannot be overestimated. It is a big thing. In
particular because it will lower the bar doing asynchronous programming
in Python and make it approachable to a wider audience.

Other languages are at different stages to similar syntax.

Eg JavaScript: ES7 (ES2016)

Here is a very nice intro

http://rossboucher.com/await/#/

that shows of the progression we’ve come along from

callbacks (hell) -> promises -> co-routines (async/await)

Well, just my 2cts. What do you think?

Cheers,

/Tobias

Note: we need to update our docs

https://github.com/crossbario/autobahn-python/issues/653

Any help on that would be highly appreciated!

0 Likes

#3

Hi Roger!

Thanks for the offer - and I’ll gladly take you up on it!

We’ll add an ‘about’ section with explanation, feature overview etc. to the Crossbar.io site soon. Feedback on that would be great.

Regards,

Alex

Regards,

···

Am Dienstag, 3. Mai 2016 00:04:37 UTC+2 schrieb Roger Erens:

Hi,

I would like to proofread any updated docs and try to provide constructive criticism.

Cheers,

Roger

Op donderdag 28 april 2016 08:05:11 UTC+2 schreef Tobias Oberstein:

Hi,

for the fun, here is the result from a mini survey about above question

https://twitter.com/oberstet/status/724705121037369344

Takeaway: 76% of the respondents prefer the latest Python 3.5+ way of
doing co-routines!

That is, using the new async/await keywords and syntax introduced with
Python 3.5.

This is interesting!

And FWIW, I agree and would have voted the same (can’t, since I started
the survey).

For writing new app code (that doesn’t have legacy or backward compat.
requirements) the new way (async/await) is just very nice and clean.

Note: for libraries (like Autobahn) and black-box code (like
Crossbar.io), this is different, because there are different goals and
requirements here.

Here is how this flavor looks like:


import asyncio



async def slow_operation(n):

     await asyncio.sleep(1)

     print("Slow operation {} complete".format(n))





async def main():

     await asyncio.wait([

         slow_operation(1),

         slow_operation(2),

         slow_operation(3),

     ])



loop = asyncio.get_event_loop()

loop.run_until_complete(main())

http://makina-corpus.com/blog/metier/2015/python-http-server-with-the-new-async-await-syntax


If you have opinions/feedback about this, that would be really
interesting for me.

Personally I think that Python with the new async/await stuff finally
has reached the status of first-class, built-in asynchronous programming
support.

And I think this cannot be overestimated. It is a big thing. In
particular because it will lower the bar doing asynchronous programming
in Python and make it approachable to a wider audience.

Other languages are at different stages to similar syntax.

Eg JavaScript: ES7 (ES2016)

Here is a very nice intro

http://rossboucher.com/await/#/

that shows of the progression we’ve come along from

callbacks (hell) -> promises -> co-routines (async/await)

Well, just my 2cts. What do you think?

Cheers,

/Tobias

Note: we need to update our docs

https://github.com/crossbario/autobahn-python/issues/653

Any help on that would be highly appreciated!

0 Likes