Если запустить 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
🌎 Sleeping through winter? The edible dormouse takes hibernation to extremes, snoozing up to 11 months a year in underground burrows to survive food shortages. ✨
#mammals⚡#hibernation⚡#adaptation
👉subscribe Interesting Planet
🌎 In the remote Tibetan Plateau, the Himalayan marmot hibernates for up to 7 months each year. During this deep sleep, its heart rate and body temperature drop dramatically—allowing survival through brutally cold, snowbound winters underground. ✨
#mammals⚡#adaptation⚡#hibernation
👉subscribe Interesting Planet
🇯🇵🐻Au Japon, les ours sortent d’hibernation: un habitant a été tué, un policier blessé, rapporte l’agence Kyodo.
En 2025, treize personnes ont été tuées au Japon à la suite d’attaques d’ours. 230 habitants ont été blessés ou mutilés.
#hibernation#ours#attaques