Skip to main content

Python's AsyncIO:A Hands-On Walkthrough

· 38 min read ·
Castamere
Code Aesthetic

Python’s asyncio library enables you to write concurrent code using the async and await keywords. The core building blocks of async I/O in Python are awaitable objects—most often coroutines—that an event loop schedules and executes asynchronously. This programming model lets you efficiently manage multiple I/O-bound tasks within a single thread of execution

In this tutorial, you’ll learn how Python asyncio works, how to define and run coroutines, and when to use asynchronous programming for better performance in applications that perform I/O-bound tasks

By the end of this tutorial, you’ll understand that:

  • Python’s asyncio provides a framework for writing single-threaded concurrent code using coroutines, event loops, and non-blocking I/O operations
  • For I/O-bound tasks, async I/O can often outperform multithreading—especially when managing a large number of concurrent tasks—because it avoids the overhead of thread management
  • You should use asyncio when your application spends significant time waiting on I/O operations, such as network requests or file access, and you want to run many of these tasks concurrently without creating extra threads or processes
important

This Article is a repost of Python's asyncio: A Hands-On WalkthroughExternal Link. Only for Chinese Translation and no commercial use. If any violation of copyright, please contact me to delete it

Talk 001 · VScode / Copilot 25.08 Update

· 3 min read ·
Castamere
Code Aesthetic

VS code launched August Update (V1.103.0). Copilot also updated GPT-5, Let's take a look

VS code Updates

Copilot Updates

I have only listed some updates that I find interesting (and often used myself). For the complete release notes, please refer to hereExternal Link

React SSR 水合问题

· 9 min read ·
Castamere
Code Aesthetic

前端真是噩梦啊

新做的首页展示博客和项目的组件,悄悄的在 F12 中报错,没有影响到使用,也就没发现,但一看到就受不了了

研究发现是 SSR 水合问题(Server Side Rendering Hydration Problem),遂写一篇记录一下历程

info

SSR 水合问题(Server Side Rendering Hydration Problem)是指在服务端渲染(SSR)应用中,服务端生成的 HTML 与客户端 JavaScript 接管后的状态不一致,导致 React 需要重新渲染整个组件树的问题

至于为什么叫水合问题,请往下看

SSH 公私钥权限问题

· One min read ·
Castamere
Code Aesthetic

ssh 的公私密钥有着很严格的权限管理,在某些设备上会很棘手。一般来说,你的 /root 下不能有其他用户的任何权限,这就很头疼。本篇提供一种解决方式,单独创建一个 ssh key 文件夹