@sickipedia · Post #9696 · 23.02.2025 г., 06:01
"Why are you so calm?". "I never argue with stupid people. I just say 'you're right' and move on. "That's ridiculous!". "You're right." #roast@Sickipedia
Hashtags
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
Пребарај: #roast
@sickipedia · Post #9696 · 23.02.2025 г., 06:01
"Why are you so calm?". "I never argue with stupid people. I just say 'you're right' and move on. "That's ridiculous!". "You're right." #roast@Sickipedia
Hashtags
@sickipedia · Post #9619 · 29.01.2025 г., 07:01
My buddy quit his job at BMW. He of course gave no indication that he was leaving. #roast@Sickipedia
Hashtags
@sickipedia · Post #9601 · 23.01.2025 г., 07:01
My wife asked me, “Can we have some peace and quiet while I cook dinner?” So I took out the batteries from the smoke alarm. #roast@Sickipedia
Hashtags
@sickipedia · Post #9558 · 08.01.2025 г., 11:01
I had a big fight with my wife, I yelled at her, "When you finally die, I'm getting you a headstone that says, 'Here Lies My Wife - Cold As Ever'." "Yeah well," she shouted back, "When you die, I'm getting you a headstone that says, 'Here Lies My Husband - Stiff At Last." #roast@Sickipedia
Hashtags
@sickipedia · Post #9550 · 05.01.2025 г., 15:01
My coworker said: “ You should not eat red meat.” I said, “My grandmother lived to be 97.”… She said, “Did she eat red meat?” I said, “No. She minded her own business.” #roast@Sickipedia
Hashtags
@sickipedia · Post #9512 · 24.12.2024 г., 07:01
I named my daughter after my mother-in-law. Raving Psycho will soon be a year old. #roast@Sickipedia
Hashtags
@sickipedia · Post #9506 · 22.12.2024 г., 07:01
My son’s teacher thinks my son has a low IQ judging by his homework. That’s absurd! My son is perfectly normal! I did his homework. #roast@Sickipedia
Hashtags
@sickipedia · Post #9485 · 15.12.2024 г., 06:01
My wife asked me, "is it just me or is the cat getting fat?" "no, it's just you." #roast@Sickipedia
Hashtags
@sickipedia · Post #9162 · 28.08.2024 г., 11:01
I asked my mom If I was an accident. She said, "No, of course not. Your brother was the accident. You were a mistake". #roast @Sickipedia
Hashtags
@sickipedia · Post #9055 · 24.07.2024 г., 11:01
Politicians and diapers have one thing in common: they should both be changed regularly… and for the same reason. #roast @Sickipedia
Hashtags
@sickipedia · Post #9052 · 23.07.2024 г., 11:01
A man who owned a sausage factory was showing his arrogant asshole son around his factory. Try as he might to impress his snobbish son, his son would just sneer and look down his nose at everything. They approached the heart of the factory, where the father thought, "This should impress him!" He showed his son a machine and said, "Son, this is the heart of the factory. With this machine here we can put in a pig, and out come sausages." The son, unimpressed, said, "Yes, but do you have a machine where you can put in a sausage and out comes a pig?" The father, "Yes son, we call it your mother." #roast @Sickipedia
Hashtags
@sickipedia · Post #8871 · 22.05.2024 г., 11:01
Wife: "How would you describe me?" Husband: "ABCDEFGHIJK." Wife: "What does that mean?" Husband: "Adorable, beautiful, cute, delightful, elegant, fashionable, gorgeous, and hot." Wife: "Aw, thank you, but what about IJK?" Husband: "I'm just kidding!" #roast @Sickipedia
Hashtags