tezvyn:

asyncio: Transports Move Bytes, Protocols Decide Which Bytes

Source: docs.python.orgadvanced

asyncio Transports are the "how" (moving bytes), while Protocols are the "what" (deciding which bytes to send). They're the low-level foundation for libraries handling raw socket I/O.

Think of asyncio Transports as the delivery truck (how bytes move) and Protocols as the manifest (what bytes to send and how to process arrivals). A transport abstracts the raw socket, while the protocol implements your application's logic via callbacks. This model is for library authors building high-performance network tools, like an HTTP client or database driver. The footgun: application developers should avoid them; stick to high-level async/await stream APIs, which are built on top of these primitives.

Read the original → docs.python.org

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.

asyncio: Transports Move Bytes, Protocols Decide Which Bytes · Tezvyn