Skip to content

Commit

Permalink
Mention condition import of asyncio.timeout / async_timeout.timeout i…
Browse files Browse the repository at this point in the history
…n README.rst (#424)
  • Loading branch information
asvetlov authored Nov 6, 2024
1 parent 8a232d0 commit 380e8ba
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
-------------
Expand Down

0 comments on commit 380e8ba

Please sign in to comment.