QUIZ_PYTHON Telegram 3936
Cоздаем объект Future из модуля asyncio (это не то же самое, что concurrent.futures.Future:


future = asyncio.Future()


Cоздаем новую задачу, которая будет выполняться асинхронно


asyncio.create_task(set_after_delay(future))


Она:
- Принимает future как параметр
- Ждет 1 секунду
- Устанавливает результат в future

Ждем, пока future получит результат. Это не блокирует весь интерпретатор, а только текущую корутину:


result = await future


Это еще называют «Неблокирующим ожиданием».
🔥1😐1



tgoop.com/quiz_python/3936
Create:
Last Update:

Cоздаем объект Future из модуля asyncio (это не то же самое, что concurrent.futures.Future:


future = asyncio.Future()


Cоздаем новую задачу, которая будет выполняться асинхронно


asyncio.create_task(set_after_delay(future))


Она:
- Принимает future как параметр
- Ждет 1 секунду
- Устанавливает результат в future

Ждем, пока future получит результат. Это не блокирует весь интерпретатор, а только текущую корутину:


result = await future


Это еще называют «Неблокирующим ожиданием».

BY Python: задачки и вопросы


Share with your friend now:
tgoop.com/quiz_python/3936

View MORE
Open in Telegram


Telegram News

Date: |

Commenting about the court's concerns about the spread of false information related to the elections, Minister Fachin noted Brazil is "facing circumstances that could put Brazil's democracy at risk." During the meeting, the information technology secretary at the TSE, Julio Valente, put forward a list of requests the court believes will disinformation. Telegram channels enable users to broadcast messages to multiple users simultaneously. Like on social media, users need to subscribe to your channel to get access to your content published by one or more administrators. But a Telegram statement also said: "Any requests related to political censorship or limiting human rights such as the rights to free speech or assembly are not and will not be considered." 2How to set up a Telegram channel? (A step-by-step tutorial) Hashtags
from us


Telegram Python: задачки и вопросы
FROM American