Если запустить 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
🌍 The world's largest freshwater reserves are hidden underground as groundwater, not in lakes or rivers. These reserves are vital for drinking water and irrigation in many regions. ✨
#groundwater⚡#freshwater⚡#resources⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography🌍
🌍 Rainwater can travel deep underground, sometimes moving through rock layers for thousands of years before resurfacing as springs. This hidden journey is a key part of Earth's water cycle. ✨
#hydrology⚡#groundwater⚡#springs⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography🌍
🌎 Amsterdam’s famous canal system shaped the city’s landscape but also lowered the local water table. Over 1,500 wooden bridge and building foundations are now monitored for rotting due to changing groundwater levels. ✨
#Amsterdam⚡#canals⚡#urbanization⚡#groundwater
👉subscribe Interesting Planet
👉more Channels