Если запустить 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
🌍 The world’s biggest human migration still happens every year in China, as hundreds of millions travel during Lunar New Year— the largest annual movement of people on Earth. ✨
#migration⚡#population⚡#movement⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography
👉more Channels
🌍 In 2022, the number of international migrants reached an estimated 281 million—more than triple the figure from 1970—making up 3.6% of the world’s total population today. ✨
#migration⚡#demographics⚡#movement⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography
👉more Channels
🌍 Since the 1990s, the number of people living outside their birthplace has more than doubled, with most international migration now happening between countries in Asia and Europe. ✨
#migration⚡#demography⚡#movement⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography🌍
🌍 Tokyo’s Shibuya Crossing is one of the busiest pedestrian intersections in the world, where as many as 3,000 people can cross with every green light, illustrating dense urban flow. ✨
#city⚡#infrastructure⚡#movement⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography🌍