Skip to content

Commit 380e8ba

Browse files
authored
Mention condition import of asyncio.timeout / async_timeout.timeout in README.rst (#424)
1 parent 8a232d0 commit 380e8ba

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

README.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ Anyway, using upstream is highly recommended. ``asyncio_timeout`` exists only fo
2929
sake of backward compatibility, easy supporting both old and new Python by the same
3030
code, and easy misgration.
3131

32+
If rescheduling API is not important and only ``async with timeout(...): ...`` functionality is required,
33+
a user could apply conditional import::
34+
35+
if sys.version_info >= (3, 11):
36+
from asyncio import timeout, timeout_at
37+
else:
38+
from async_timeout import timeout, timeout_at
39+
3240

3341
Usage example
3442
-------------

0 commit comments

Comments
 (0)