Если запустить 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
Whenever NEA receives feedback on noise or smell nuisance, #NEAofficers such as Joey would investigate the root cause and try to resolve the issues for residents. Read on to find out more about his winning formula: https://www.facebook.com/NEASingapore/posts/324902236450865
#PeopleofNEA#NEA20
When #NEAOfficer Hamdan received a compliment from a resident for responding to his feedback on a Sunday, he was very surprised. Read on to find out why: https://www.facebook.com/NEASingapore/posts/344176487856773
#PeopleofNEA#NEA20
What is the skill that our #NEAofficer, Sarmad, learnt at 16 years old that became useful when he turned 60? Read on to find out more: https://www.facebook.com/NEASingapore/posts/334885492119206
#PeopleofNEA#NEA20