Если запустить 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
🌍 In Shenzhen, China, nearly all public buses and taxis run on electricity, making it the world’s first major city to fully switch its urban transit fleet to electric vehicles. ✨
#urbangeography⚡#transport⚡#innovation⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography
👉more Channels
🌍 Melbourne, Australia, is regularly ranked as one of the world’s most liveable cities thanks to its blend of extensive parks, creative laneways, and a tram network that covers over 250 kilometers. ✨
#urbangeography⚡#citylife⚡#infrastructure⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography
👉more Channels
🌍 The world’s tallest residential building, Central Park Tower in New York City, rises 472 meters. Ultratall skyscrapers like this change city skylines and challenge how we design urban living spaces. ✨
#urbangeography⚡#skyscraper⚡#citylife⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography
👉more Channels
🌍 In Seoul, over half the city’s rooftops host gardens, solar panels, or small farms—turning unused urban spaces into green zones that cool neighborhoods and boost local food production. ✨
#urbangeography⚡#cityplanning⚡#greencities⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography
👉more Channels