Если запустить 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
🌎 On Neptune’s largest moon Triton, geysers of nitrogen ice erupt from beneath the surface, shooting plumes up to 8 kilometers high into the tenuous atmosphere. These cryovolcanic eruptions are driven by sunlight warming a thin layer of transparent ice, a unique phenomenon that shapes Triton's mysterious, dark-streaked terrain. ✨
#Triton⚡#cryovolcanism⚡#Neptune
👉subscribe Universe Mysteries
🪐 Pluto's largest moon, Charon, may hold a secret beneath its icy exterior—a hidden ocean of liquid water. Signs of ancient cryovolcanism (volcanoes that erupt ice instead of lava) and fractures in Charon’s surface, revealed by NASA’s New Horizons spacecraft, suggest that internal heat could have once melted the ice deep inside, creating an underground sea in this distant, frozen world. ✨
#Charon⚡#oceans⚡#cryovolcanism⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries
👉more Channels