Если запустить REPL с модулем asyncio, то вы входите в особый асинхронный REPL.
user@host:~$ python -m asyncio
asyncio REPL 3.12.7 ...
Use "await" directly instead of "asyncio.run()".
>>> import asyncio
>>>
В этом режиме
- создаётся и настраивается event loop
- уже импортирован asyncio
- работает await на верхнем уровне
То есть такая команда сработает без ошибок!
await asyncio.sleep(3)
Удобно для тестирования асинхронных функций без создания ивентлупов и остальной обвязки.
Работает в: 3.8+
#tricks#async
#BREAKINGNEWS
🔴 US President Biden confessed
- Were these bombs that were stopped from being shipped to Israel used to kill civilians in Gaza?
+ They were previously used to kill civilians in Gaza and destroy population centers.
🚨
🚨
🚨#BREAKINGNEWS
The occupying Israeli army has launched a very violent attack on the east of Rafah as of now.
The attacked areas are the area that Israel demanded to be evacuated in the morning.
🚨#BREAKINGNEWS
The Kassam Brigades broadcast the moments of shelling the Israeli occupation forces with heavy caliber mortars in Netsarim, south of Gaza City.
🚨#BREAKINGNEWS
A Turkish youth staged a stabbing operation in Israeli-occupied Jerusalem, wounding an Israeli policeman. The youth was martyred. (Haaretz)