Если запустить 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
G20's #DigitalInnovationAlliance is promoting #Startups with digital solutions from across the world!
Want to contribute in this global journey?
Design a logo for G20-DIA
Visit: https://www.mygov.in/task/logo-design-competition-g20-dia/
"G20-DIA bringing Hon'ble PM Narendra Modi's dream to life"
Be part of G20 #DigitalInnovationAlliance.
Know more & Apply at: meitystartuphub.in/g20-dia/
#G20India#G20DEWG
Are you interested in creating digital innovations for the upliftment of societies?
Participate in G20 #DigitalInnovationAlliance
Visit: https://mygov.in/task/launch-applications-g20-digital-innovation-alliance/
#G20DIA#G20India
Calling startups in the field of #agritech & other sectors, developing digital solutions that can reduce the digital divide and boost the global economy for G20 #DigitalInnovationAlliance.
Know more at https://mygov.in/task/launch-applications-g20-digital-innovation-alliance/
#G20India