Simon Willison’s Weblog

Subscribe

Entries tagged patterns, plugins in 2020

Filters: Type: entry × Year: 2020 × patterns × plugins × Sorted by date


The “await me maybe” pattern for Python asyncio

I’ve identified a pattern for handling potentially-asynchronous callback functions in Python which I’m calling the “await me maybe” pattern. It works by letting you return a value, a callable function that returns a value OR an awaitable function that returns that value.

[... 787 words]

Types

Years

Months

Tags