News for hackers. Stuff that matters.
Re:The magic of asyncio explained by toast0 on Wednesday August 08, 2018 @12:51AM (#17713274)
They're sort of similar, and you can probably get the same work done in either system, but I think real threading (green or otherwise), may leave you with less cognitive load. Spawning a thread may be complex, and thinking about how the threads are scheduled is often complex, but what each thread does can be very simple -- and you don't have to think about 'long running things need to be futured/awaited', you just do things in a straightforward way in the thread (caveat: slightly less straightforward if you need thread actions to be cancellable).

Green threads may be running an event loop underneath, but it's a useful abstraction in many contexts.

Re:The magic of asyncio explained by pdkl95 on Wednesday August 08, 2018 @01:40AM (#17713451)
> ... you don't have to think about 'long running things need to be futured/awaited', you just do things in a straightforward way in the thread

https://www.youtube.com/watch?v=bzkRVzciAZg

Six years later, very little has change in the arguments about events vs threads.

Re:The magic of asyncio explained by pas on Wednesday August 08, 2018 @05:08AM (#17714212)
> Spawning a thread may be complex, and thinking about how the threads are scheduled is often complex, but what each thread does can be very simple

And that's how it starts, and in the end it's New Year's Eve and you're somehow, again, debugging a deadlock.

> green threads

yes please

Re:The magic of asyncio explained by gpderetta on Wednesday August 08, 2018 @10:43AM (#17716351)
You can deadlock with futures as well. Except that with futures you do not get a (two actually) nice call stack pointing to the deadlocked resource.
Re:The magic of asyncio explained by yen223 on Wednesday August 08, 2018 @01:07AM (#17713331)
Python has proper threads, and they're anything but simple.
Re:The magic of asyncio explained by toast0 on Thursday August 09, 2018 @04:43PM (#17728315)
Python threads aren't simple, because of the shared everything model python uses, so any variable access requires the GIL. Shared nothing threads are much simpler to work with.