Earlier quoted context omitted.
I'm not entirely sure how "3rd party library bug" is python's fault.
So you are at least a little sure. A little too much for my taste ;)
Python has had async for 10 years – why isn't it more popular?
291–300 of 305 posts
Re: Python has had async for 10 years – why isn't it more popular?
#292It’s probably related to the fact that when they added “await” to JavaScript, it seemed to become the most popular keyword in the language overnight, just comical amounts of it in the average new JavaScript file in the wild.
Re: Python has had async for 10 years – why isn't it more popular?
#293You can’t just plug and play it. As soon as you introduce async you need to have the runtime loop and so on. Basically the whole architecture needs to be redesigned
asyncio has been designed to be as "plug and play" as it gets. I'd discourage it, but one could create async loops wherever one would need them, one separate thread per loop, and adapt the code base in a more granular fashion. Blocking through the GIL will persist, though. For any new app that is mostly IO constraint I'd still encourage the use of asyncio from the beginning.
Re: Python has had async for 10 years – why isn't it more popular?
#294I've had no real issues with async, although I primarily use libraries like aiohttp and aiosqlite and even write my own helpers ( https://github.com/rcarmo/aioazstorage is a good example). The vast majority of the Python code I wrote in the last 5-6 years uses asyncio, and most of the complaints I see about it (hard to debug, getting stuck, etc.) were -- at least in my case -- because there were some other libraries…
I share your experience asyncio is easier than threads or multiprocess: less locking issue, easier to run small chunks of code in // (easier to await something than to create a thread that run some method)
Re: Python has had async for 10 years – why isn't it more popular?
#295The author gets close to what I think the root problem is, but doesn't call it out. The truth is that in python, async was too little, too late. By the time it was introduced, most people who actually needed to do lots of io concurrently had their own workarounds (forking, etc) and people who didn't actually need it had found out how to get by without it (multiprocessing etc). Meanwhile, go showed us what good green…
>most people who actually needed to do lots of io concurrently had their own workarounds (forking, etc) and people who didn't actually need it had found out how to get by without it (multiprocessing etc). The problem is not python, it's a skill issue. First of all forking is not a workaround, it's the way multiprocessing works at the low level in Unix systems. Second of all, forking is multiprocessing, not multithrea…
Re: Python has had async for 10 years – why isn't it more popular?
#296Earlier quoted context omitted.
I don't understand this criticism. The JVM is opaque, App Engine is opaque, Docker is opaque. All execution environments are opaque unless you've attached a debugger and are manually poking at the thing while it runs.
Some are more opaque than others.
If even this does not help, rm -rf is your friend.
Re: Python has had async for 10 years – why isn't it more popular?
#297I love JS's async. I don't know how anyone ever did anything useful in the language before it was introduced. I think something between a third and half of the functions and members in LisaGUI are probably async functions at this point.
We used callbacks and generators. It was a bit messy at times, but really, it wasn't all that different. I still use generators quite often.
Re: Python has had async for 10 years – why isn't it more popular?
#298Earlier quoted context omitted.
I think Python async is pretty cool - much nicer than threading or multiprocessing - yet has a few annoying rough edges like you say. Some specific issues I run into every time: Function colours can get pretty verbose when you want to write functional wrappers. You can end up writing nearly the exact same code twice because one needs to be async to handle an async function argument, even if the real functionality of…
> You can end up writing nearly the exact same code twice because one needs to be async to handle an async function argument, even if the real functionality of the wrapper isn't async. Sorry for the possibly naive question. If I need to call a synchronous function from an async function, why can't I just call await on the async argument? def foo(bar: str, baz: int): # some synchronous work pass async def other(bar: A…
Re: Python has had async for 10 years – why isn't it more popular?
#299Earlier quoted context omitted.
Interesting that very few people in that thread seem to understand Go's model, especially the author of this proposal. If you don't allow preemption, you still have a sort of coloring because most non async functions aren't safe to call in a virtual thread - they may block the executor. If you call C code, you need to swap out stacks and deal with blocking by potentially spawning more OS threads - that's what CGo doe…
I can't speak to the more technical aspects you bring up b/c I'm not that well versed in the underlying implementations and tradeoffs. > and also too little too late. I think it very likely that Python will still be around and popular 10 years from now. Probably 20 years from now. And maybe 30 years from now. I think that's plenty of time for a new and good idea that addresses significant pain points to take root and…