Стандартная библиотека asyncio это стандарт (начиная с Py3.4) для работы с асинхронным кодом. Но эта библиотека достаточно низкоуровневая, со своими проблемами, устаревшими подходами.
Чтобы исправить это, были созданы разные обертки и альтернативы с реализацией популярных инструментов и паттернов асинхронного программирования. Это такие библиотеки как:
- trio: улучшает корректность выполнения, не оставляя потерянных корутин при ошибках, то есть предлагает Structured Concurrency из коробки.
- curio: упрощение синтаксиса и читаемости кода, больше похоже на работу с потоками.
- anyio: универсальная обертка над asyncio или trio плюс множество вспомогательных инструментов.
anyio используется в FastAPI как основная библиотека для работы с асинхронным кодом и вызовом синхронного кода из асинхронного.
В общем, рекомендую почитать про возможности anyio, возможно вы более не будете использовать чистый asyncio в своих проектах)
Это совсем не значит что дефолтный asyncio плох, он тоже даёт достаточный для работы функционал и продолжает развиваться. Например, в версии 3.11 появились TaskGroup, с похожим на trio функционалом. Так что он тоже актуален, просто придется больше написать кода самостоятельно.
#libs#async
#HawkerHeritage📢 Originally the Seng Poh Road Market in 1951, Tiong Bahru Market served as a bustling centre for the community. Next time you’re there for a meal, don’t forget to soak up the history & nostalgia!
#OurHawkerCulture#OurHawkerCentres
#HawkerHeritage Fancy A Feast in a Garden 🌴? Since 1971, Newton Food Centre hawker has been serving up Singapore’s culinary diversity with its unique 'garden city' charm. Forward this post to someone who’ll appreciate this picturesque setting!
#OurHawkerCulture#OurHawkerCentres#HawkerHeritage
#HawkerHeritage📜 Tekka Centre: Let’s time-travel back to 1915, where 'Kandang Kerbau' and ‘Tekka’ tell tales of cattle and wild bamboo. What a journey for the senses!
#OurHawkerCulture#OurHawkerCentres
#HawkerHeritage🌟 People’s Park Food Centre: A Culinary Heritage Site 🌟 Starting as a hawker shelter in 1923 and evolving into the largest market by 1940, it's a place where history and cuisine meet. Share this with someone that you’ll like to explore this iconic food haven with!
#OurHawkerCulture#OurHawkerCentres
#HawkerHeritage🍲✨ Experience a rich blend of history and culinary excellence at Singapore's largest hawker centre: Chinatown Complex Market! Established in 1981 for the last of Chinatown’s street hawkers, it's now a vibrant gastronomic haven with around 700 stalls. Share this with your favourite foodies!
#OurHawkerCulture#OurHawkerCentres
#HawkerHeritage Changi Village Hawker Centre: From a military past to a seaside food haunt 🌴#DidYouKnow This dining spot was part of Changi's transformation into a resort? An idyllic memory to savour with your favourite hawker delights!
#OurHawkerCulture#OurHawkerCentres
#HawkerHeritage Architectural elegance meets culinary delight at Old Airport Road Food Centre 🍴🏛️#DidYouKnow that its modern structure was designed in '73 to match the housing estates in the area?
#OurHawkerCulture#OurHawkerCentres
#HawkerHeritage#DidYouKnow Adam Road Food Centre is nine-sided and almost circular? This popular spot is famous for its nasi lemak and a variety of delightful treats! This is your sign to organise that makan trip🍴
#OurHawkerCulture#OurHawkerCentres
❤️#HawkerHeritage❤️#DidYouKnow that Maxwell Food Centre was once a wet market? It was also one of the places where the poor and displaced could find cheap meals after WWII. Today, it’s a treasure trove of local delights!
#OurHawkerCulture#OurHawkerCentres