TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #401 · 15 дек.

Функция asyncio.wait() это еще один способ вызвать множество асинхронных задач. Она работает в нескольких режимах. 1. Самый простой - ждем завершения всех задач async def main(): tasks = [asyncio.create_task(do_it(i)) for i in range(10)] done, pending = await asyncio.wait( tasks, return_when=asyncio.ALL_COMPLETED ) for task in done: try: print(task.result()) except Exception as e: print(e) Очень похоже на gather, но работает не так. ▫️возвращает не результаты, а два сета с объектами Task у которых можно забрать результат через task.result() если они в списке done ▫️не гарантирует порядок результатов так как оба объекта это set ▫️не выбрасывает исключение когда оно появляется, а сохраняет его в Task. Исключение появится когда попробуете забрать резултьтат. 2. Ждем завершения первой задачи, даже если там ошибка. async def main(): tasks = [asyncio.create_task(do_it(i)) for i in range(3)] done, pending = await asyncio.wait( tasks, return_when=asyncio.FIRST_COMPLETED ) # в done может быть несколько задач! for task in done: try: print(task.result()) except Exception as e: print(f"Fail: {e}") # Оставшиеся задачи в pending, как правило, нужно отменить, иначе они будут продолжать работать for task in pending: task.cancel() В сете done будут таски которые успели завершится, причем как успешно так и нет. 3. До первой ошибки. Тоже самое, но с аргументом FIRST_EXCEPTION done, pending = await asyncio.wait( tasks, return_when=asyncio.FIRST_EXCEPTION ) Функция завершается как только первая задача упадет с ошибкой. Учтите, что в любом случае done вы можете обранужить несколько задач, как с ошибками так и успешные. ↗️ Полный листинг примеров здесь #async

Hashtags

Резултати

Пронајдени 3 слични објави

Пребарај: #stubb

当前筛选 #stubb清除筛选
RT en français

@RTenfrancais · Post #79912 · 23.04.2026 г., 15:02

⏺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 !

Hashtags

American Оbserver

@american_observer · Post #4859 · 15.01.2026 г., 00:03

📰 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 🇺🇸