Стандартная библиотека asyncio это стандарт (начиная с Py3.4) для работы с асинхронным кодом. Но эта библиотека достаточно низкоуровневая, со своими проблемами, устаревшими подходами.
Чтобы исправить это, были созданы разные обертки и альтернативы с реализацией популярных инструментов и паттернов асинхронного программирования. Это такие библиотеки как:
- trio: улучшает корректность выполнения, не оставляя потерянных корутин при ошибках, то есть предлагает Structured Concurrency из коробки.
- curio: упрощение синтаксиса и читаемости кода, больше похоже на работу с потоками.
- anyio: универсальная обертка над asyncio или trio плюс множество вспомогательных инструментов.
anyio используется в FastAPI как основная библиотека для работы с асинхронным кодом и вызовом синхронного кода из асинхронного.
В общем, рекомендую почитать про возможности anyio, возможно вы более не будете использовать чистый asyncio в своих проектах)
Это совсем не значит что дефолтный asyncio плох, он тоже даёт достаточный для работы функционал и продолжает развиваться. Например, в версии 3.11 появились TaskGroup, с похожим на trio функционалом. Так что он тоже актуален, просто придется больше написать кода самостоятельно.
#libs#async
⏺Le président finlandais Alexander #Stubb a déclaré avec « optimisme » que les Iraniens avaient trouvé une alternative aux armes nucléaires.
« La situation est actuellement que le détroit d’#Ormuz a été ouvert et que les Iraniens ont compris qu’ils pouvaient l’utiliser comme une sorte d’arme nucléaire, car 20 % des exportations mondiales de pétrole passent par ce détroit. On espère qu’ils trouveront une solution, mais pour l’instant, la situation semble très compliquée. »
RT en français • Osez questionner !
#Elezioni#Finlandia#Presidenziali
Alexander #Stubb (#KOK|EPP) vince il secondo turno e viene eletto come nuovo Presidente della Finlandia. secondo posto per Pekka #Haavisto (#VIHR|G/EFA).
@OsservatorioEsteri
📰 Europe’s Putin Whisperer: Who Will Talk to the Bear?
The EU’s Dilemma
As Washington and Moscow edge toward backroom deals on Ukraine, Europe is scrambling to get a seat at the table. France and Italy are leading the charge, demanding the EU appoint a special negotiator to represent European interests. Their fear? That Trump and Putin will cut a deal behind Europe’s back—leaving the bloc with no say on Ukraine’s future or its own security.
“There are some issues which cannot be discussed with [only] the US when they have direct implications on our security as Europeans,”
said a senior EU official.
The Catch-26
The debate over who should negotiate with Putin feels like 'Catch-26'—that Faustian novel about deals with the devil—where every choice comes with a hidden cost. Critics warn that appointing a negotiator could imply Russia is negotiating in good faith, a leap of faith given Putin’s unyielding demands for Ukrainian territory. Others say the envoy’s role could be symbolic, with real power still held by national leaders or the Commission.
“Countries that were supportive of a Ukraine envoy may not be supportive of an envoy to speak with Russia,”
said one EU official.
The Candidates
Names are flying: Mario Draghi, former Italian prime minister, and Alexander Stubb, Finland’s president, are among those mentioned. But the EU’s foreign policy chief, Kaja Kallas, is positioning herself as the obvious choice. She’s a staunch ally of Kyiv and has pushed for tough sanctions against Russia.
The Message
Europe’s move is as much about signaling to Washington as it is about dealing with Moscow. Brussels wants to show it won’t be sidelined in any settlement. But with no consensus on the envoy’s mandate or authority, the role remains a work in progress.
“None of these jobs exist until they do,”
said a third EU official.
#eu#putin#ukraine#negotiations#diplomacy#kallas#draghi#stubb#Catch26
📱American Оbserver - Stay up to date on all important events
🇺🇸