Breadcrumbs Collector

Acquiring knowledge one crumb at a time

Category

asyncio

What is asyncio’s ensure_future?

tl;dr ensure_future let’s us execute a coroutine in the background, without explicitly waiting for it to finish. If we need, we can wait for it later or poll for result. In other words, this is a way of executing code in asyncio without await.

asyncio – choosing the right executor

During application development with asyncio you will inevitably encounter situation when there is no asyncio-compatible library to use. It may be an API client for our business partner built with excellent requests library (that naturally doesn’t work well with asyncio)… Continue Reading →

Dive into Python’s asyncio, part 5 – protocols

Protocols are asyncio’s primitives supplied as convenient base classes to quickly set up clients or servers using TCP/UDP (+ subprocesses). These are especially helpful when we need to implement low level handling of protocol of some sort. I believe they… Continue Reading →

Dive into Python’s asyncio, part 4 – simple chat with Sanic

Let’s roll with something practical, namely a simple chat application using Sanic framework mentioned in previous post. Sanic supports websockets out of the box thanks to the websockets library. It’s super easy to write a handler function by using decorator… Continue Reading →

Dive into Python’s asyncio, part 3 – web framework

Few days ago while I was reading fullstackpython.com I came across new pythonic micro web framework based on asyncio – Sanic. Coolest thing about Sanic is that it leverages asyncio providing better performance and more efficient hardware utilization. Although it’s… Continue Reading →

Dive into Python’s asyncio, part 2

All examples were tested under Python 3.6. The only asyncio rule After reading part 1 you should already know, that a heart of asyncio is an event loop. There is exactly one rule – do not block the event loop!… Continue Reading →

Dive into Python’s asyncio, part 1

Concurrency was not seriously taken into account in Python when it was designed. Until 3.4 version, there were two options: threading multiprocessing Although these two modules provided programmers with handy primitives and API, they both have considerable downsides. Due to… Continue Reading →

© 2019 Breadcrumbs Collector — Powered by WordPress

Theme by Anders NorenUp ↑