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

TGINSIGHT SIMILAR POSTS

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

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

Три способа выполнить множество задач с asyncio Функция для примера: async def do_it(n): await asyncio.sleep(random.uniform(0.5, 1)) return n 1. Последовательный вызов async def main(): for i in range(100): result = await do_it(i) Такой вызов имеет смысл только тогда, когда результат одной задачи требуется для вызова следующей. Если они независимы, то это антипаттерн, так как аналогичен простому синхронному вызову по очереди. 2. Упорядоченный результат async def main(): tasks = [do_it(i) for i in range(100)] results = await asyncio.gather(*tasks) Выполняет корутины конкурентно и возвращает результат в виде списка. Полезен когда требуется получить результаты в том же порядке в котором задачи отправлены. 3. Результат по мере готовности tasks = [asyncio.create_task(do_it(i)) for i in range(100)] for cor in asyncio.as_completed(tasks): result = await cor Так же выполняет корутины конкурентно, но не гарантирует порядок. Результат возвращается по мере готовности, каждый отдельно. Полезен когда нужно обработать любой ответ как можно скорее. #async

Hashtags

Резултати

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

Пребарај: #breakup

当前筛选 #breakup清除筛选
Pensive|

@PensivePost · Post #5785 · 30.05.2022 г., 07:59

She was totally surprised that I’d “let her go” after she admitted the cheating. She had expected a long intensive fight. But I did not want her back. In fact never, ever. She had turned into a liar — someone who had lied for months and months, each and every day. The irony is: the literal second before she told me the truth (which I had suspected for almost six months, but which she had virgorously denied), I would have done anything for her. I had fought for many months over a period which felt like one long nightmarish night with everything I got, but as soon as the truth — and nothing but the truth — was out, the fight was over. She was a liar. Had become one. Would always be one. So I did not fight anymore. That is to say: not for her. That had become a war I could not win anymore, and one she had already lost. So she was gone forever, and I realized I had to start all over again, trying to walk to new horizons and not knowing what to expect. After 10 fucking years. The nights became cold, and silent. And she smelled blood, smelled my weakness, so she went for the kill, for the money, for the house, thinking that now I was lying in my own pool of stinking tears, she might as well bash in my head and get it over with. She announced it to her friends, to her family. She would get the money. She would ruin me — she was a new person now, and would not care about her old life, ever again. (Her words.) And, dear friend, I will end my little sermon now with my own three beautiful words. She lost again. #review #breakup #auri