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

TGINSIGHT SIMILAR POSTS

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

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

Отдельно разберём TaskGroup, который пришел на замену gather в Python 3.11. Ключевые отличия ▫️create_task() возвращает объект asyncio.Task, у которого есть соответствюущие методы управления. То есть у нас больше контроля ▫️это контекстный менеджер, который гарантирует что все таски будут остановлены по выходу из контекста ▫️ошибка автоматически отменяет незавершенные задачи, ▫️except* передает нам ExceptionGroup, в котором каждую ошибку можно обработать отдельно import asyncio import random async def do_it() -> str: if random.random() < 0.1: raise ValueError('Oops') delay = random.uniform(0.5, 1.5) await asyncio.sleep(delay) return delay async def main(): try: async with asyncio.TaskGroup() as tg: for _ in range(10): tasks.append(tg.create_task(do_it())) for t in tasks: print(t.result()) except *ValueError as e: for err in e.exceptions: print(err) asyncio.run(main()) Рекомендую изучить страницу Coroutines and Tasks из документации, где представлено больше интересных примеров и механизмов - таймауты - отмена задач - создание задач из другого потока #async

Hashtags

Резултати

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

Пребарај: #superstition

当前筛选 #superstition清除筛选
Google Facts™ [ ️@googlefactss🌎]

@googlefactss · Post #40300 · 11.12.2025 г., 19:05

“Knock on wood” is a saying people use to avoid bad luck. It may come from old beliefs that trees have spirits or from the Christian cross made of wood. Different countries have their own ways to “knock on wood” to stay lucky. For example, in Italy, people “touch iron,” and in Turkey, they knock twice and pull their earlobe. 🌳🙏🍀 [Read more] @googlefactss #KnockOnWood#GoodLuck#Superstition#Idioms#Culture

Google Facts™ [ ️@googlefactss🌎]

@googlefactss · Post #40452 · 01.01.2026 г., 11:05

Sechele I met David Livingstone in 1847 and helped start a mission. He learned to read and taught his wives the Bible. In 1848, he divorced some wives to be baptized. Sechele sent gunpowder to his uncle as a peace offering, because as a Christian he should not live in disharmony with his own family and to reunite the whole tribe, the uncle who thought it was evil magic burned it to cleanse it of evil. The following explosion killed him. This (un)lucky event helped Sechele unite his tribe. ✝️🔥🧨 @googlefactss📚✝️💥 #Sechele1#Bakwena#History#Africa#Superstition#ItAintStupidIfItWorks