Re:The magic of asyncio explained
by smittywerben on Friday August 10, 2018 @03:09PM
(#17735986)
> Python is single threaded.
That's not true, there are multiple threads in Python i.e. zlib from the standard library.
People want unsafe code to communicate concurrently through the Python thread state. I'll let someone else tackle that one.
However, to me, the implementation is a lot complex that green threads. The Future's crate has had a lot of churn, and when I first dabbled in it a while back, it was one of the first few times I struggled to understand what the compiler errors even meant as the types were so deep. Compared to golang's 'go', futures are harder to understand, plus you have to rewrite all your networking/blocking code to be compatible (Python would still likely have to do the same, but I think it could be done in such a way that if you were using the system provided networking libraries, you could get compatibility for "free").
Python doesn't benefit from the Rust benefits explained in that article. Python already has a garbage collector and runtime. Python is single threaded.
I don't follow the Python language to have a well informed opinion on why they went with futures, but I doubt its close to the reasoning that Rust chose.