- Distributed Computing with Python
- Francesco Pierfederici
- 188字
- 2021-07-09 19:30:14
Summary
Python has had support for asynchronous programming since version 1.5.2, with the introduction of the asyncore
and asynchat
modules for asynchronous network programming. Version 2.5 introduced the ability to send data to coroutines via yield
expressions, allowing us to write asynchronous code in a simpler but more powerful way. Python 3.4 introduced a new library for asynchronous I/O called asyncio.
Python 3.5 introduced true coroutine types via async def
and await
. Interested readers are encouraged to explore these new developments. One word of warning though: asynchronous programming is a powerful tool that can dramatically improve the performance of I/O-intensive code. It does not come without issues, though, the main of which is complexity.
Any important asynchronous code has to carefully select nonblocking libraries in order to avoid using blocking code. It has to implement a coroutine scheduler (since the OS does not schedule coroutines for us like it does with threads), which involves writing an event loop and adding further complexity. Reading asynchronous code can be challenging to the point that even our simple examples do not look all that simple at first sight. Handle with care!
- SPSS數據挖掘與案例分析應用實踐
- GitLab Cookbook
- Building Modern Web Applications Using Angular
- ThinkPHP 5實戰
- SpringMVC+MyBatis快速開發與項目實戰
- Android開發精要
- 騰訊iOS測試實踐
- Functional Programming in JavaScript
- Mastering Python High Performance
- 數據結構(C語言)
- 用戶體驗增長:數字化·智能化·綠色化
- 青少年信息學競賽
- Django Design Patterns and Best Practices
- 深度學習程序設計實戰
- Modernizing Legacy Applications in PHP