3 ms·
Yes, a lot of it boils down to the ecosystem split for me. > 2) Explicit yield points certainly save you from most of the classic threading errors Can you pro
by Bogdanp 8y ago
Yes, a lot of it boils down to the ecosystem split for me.
> 2) Explicit yield points certainly save you from most of the classic threading errors
Can you provide an example of such a threading error? At most I've heard people claim that asyncio removes the need for mutexes[1]. I think that may be true at the local level, but as soon as your function needs to synchronize with other async functions in the system that ceases to be the case. At any rate, that's not enough of a win to justify the split in my opinion.
> having to use special maps and datastructures everywhere.
The GIL already protects you from corrupting builtin datastructures. Neither the GIL nor asyncio protect you from corrupting your data (the need for some form of synchronization), however.
> 4) Supposedly this refers to the `open` function? This can be solved using the `aiofiles` module, but again I suppose this ties into (1).
And most operations on opened files (like `read()`) as well as any OS bindings provided by the `os` module.
[1]: Clearly, asyncio itself still thinks they're useful: https://docs.python.org/3/library/asyncio-sync.html#asyncio.Lock https://docs.python.org/3/library/asyncio-sync.html#asyncio....