Если запустить 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
🪐 Astronomers used an exploding star, supernova SN 1987A in the Large Magellanic Cloud (about 168,000 light-years away), to precisely measure the speed of light across vast space. Light and ghostly particles called neutrinos from the explosion reached Earth just hours apart, providing real proof that even over intergalactic distances, light always travels at the same constant speed—299,792 kilometers per second. ✨
#speedoflight⚡#supernova⚡#LargeMagellanicCloud⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries
👉more Channels
🪐 In the Tarantula Nebula of the Large Magellanic Cloud, light from young, massive stars races outward at the universal speed limit—299,792 kilometers per second—helping illuminate vast clouds of gas across 1,000 light-years of space. Because nothing can travel faster than this speed in a vacuum, the glow we see from such stellar nurseries is always an echo from the past, showing us cosmic events exactly as they unfolded years, decades, or even millennia ago. ✨
#speedoflight⚡#tarantulanebula⚡#largemagellaniccloud⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries