Если запустить 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
🌍 Since the 1960s, Dubai’s desert coast has transformed into a global business hub through free trade zones, drawing global companies and turning once barren sands into a vibrant economic powerhouse. ✨
#economicgeography⚡#trade⚡#urbanization⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography
👉more Channels
🌍 The Chicago area is the world’s largest concentration of inland rail and freight connections, making it a vital hub where goods from coasts and the Midwest converge before heading nationwide. ✨
#economicgeography⚡#transport⚡#trade⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography
👉more Channels
🌍 More than half of global economic activity now takes place within just 1% of the world’s land surface, showing how powerful major cities and industrial regions are for global wealth. ✨
#economicgeography⚡#cities⚡#industry⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography🌍
🌍 Japan’s Tokaido corridor between Tokyo and Osaka packs over 60 million people and is a global hub for high-speed trains, industry, and services, shaping a megaregion central to Asia’s economy. ✨
#economicgeography⚡#megaregion⚡#infrastructure⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography
👉more Channels