From 380e8ba5bf77e3cd184df8a5f51dc929d93d8553 Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Wed, 6 Nov 2024 13:54:28 +0100 Subject: [PATCH] Mention condition import of asyncio.timeout / async_timeout.timeout in README.rst (#424) --- README.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.rst b/README.rst index 549d40b..8a8066a 100644 --- a/README.rst +++ b/README.rst @@ -29,6 +29,14 @@ Anyway, using upstream is highly recommended. ``asyncio_timeout`` exists only fo sake of backward compatibility, easy supporting both old and new Python by the same code, and easy misgration. +If rescheduling API is not important and only ``async with timeout(...): ...`` functionality is required, +a user could apply conditional import:: + + if sys.version_info >= (3, 11): + from asyncio import timeout, timeout_at + else: + from async_timeout import timeout, timeout_at + Usage example -------------