Если запустить 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
🌍 Ojos del Salado, on the Chile-Argentina border, is the world’s highest active volcano at 6,893 meters. Its crater hosts a permanent lake—the highest known body of liquid water on Earth. ✨
#mountains⚡#volcanoes⚡#altitude⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography
👉more Channels
🌎 Mount Everest’s “death zone” begins at 8,000 meters above sea level, where oxygen levels are so low that humans can only survive for hours without aid. Wind chills can drop to –50°C even in summer. ✨
#Everest⚡#altitude⚡#climate
👉subscribe Interesting Planet
👉more Channels
🌍 Lake Titicaca, perched almost 3,812 meters above sea level, is the world’s highest navigable lake by large boats. Its clear waters straddle the border between Peru and Bolivia in the Andes. ✨
#lakes⚡#Andes⚡#altitude⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography🌍