Если запустить 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
🌎 Prairie dogs use a complex series of high-pitched calls to warn their colony about predators. These rodents can describe an intruder’s size, color, and speed in their alarm calls. Researchers have identified over 100 different warning sounds in a single colony. ✨
#animalbehavior⚡#communication⚡#rodents
👉subscribe Interesting Planet
👉more Channels
🌎 The tuco-tuco, a South American rodent, lives almost its entire life underground. It digs vast tunnel networks with specialized teeth, rarely surfacing except to gather food. Its burrowing helps aerate soil, making tuco-tucos quiet but essential ecosystem engineers. ✨
#rodents⚡#ecosystems⚡#burrowing
👉subscribe Interesting Planet
🐾 Capybaras are the world's largest rodents — social, semi-aquatic animals that live in groups in South America. They're so calm that other animals often sit on them, and they can even sleep underwater! 🌊
[Learn more]
@googlefactss#Capybara#AnimalFacts#Nature#Rodents#Wildlife