@QuietWorld · Post #6230 · 12.03.2019 г., 07:12
Don’t look back and wonder why things went wrong. Don’t regret not doing more. It happened for a reason. Your better days are ahead of you. #motivation#assurance @quietworld🍃
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
Пребарај: #assurance
@QuietWorld · Post #6230 · 12.03.2019 г., 07:12
Don’t look back and wonder why things went wrong. Don’t regret not doing more. It happened for a reason. Your better days are ahead of you. #motivation#assurance @quietworld🍃
Hashtags
@QuietWorld · Post #6459 · 15.05.2019 г., 04:49
#assurance#selfreminder @quietworld🍃
Hashtags
@QuietWorld · Post #6864 · 05.11.2019 г., 10:23
Two years being passive is just a blink of an eye 😉 Two years moving towards a big goal every single day is plenty of time 😮 There is nothing that cannot be accomplished in two years with enough effort 😎 #life#motivation#assurance @quietworld🍃
Hashtags
@QuietWorld · Post #6231 · 12.03.2019 г., 11:15
“When it comes to breaking old habits and starting new ones, remember to be patient with yourself. You’ve got to expect it’s going to take time and effort before you see lasting results.” #quotes#assurance#motivation @quietworld🍃
Hashtags
@QuietWorld · Post #7195 · 16.02.2020 г., 10:05
#assurance#selfcare#selfreminder @quietworld🍃
Hashtags
@QuietWorld · Post #7359 · 08.06.2020 г., 03:08
to anyone who might need this at this moment🌹 #reminder#selfcare#assurance @quieworld🍃
Hashtags
@QuietWorld · Post #7223 · 21.03.2020 г., 04:07
It is not a sin to be upset; with someone, with a situation, with yourself. Give yourself time to absorb what you're feeling until you're ready to move to where there's growth. #selfreminder#selfcare#assurance#wisdom @quietworld🍃
@QuietWorld · Post #6856 · 04.11.2019 г., 13:33
Appreciate where you are in your journey, even if it's not where you want to be - because every season serves a purpose. #life#quotes#assurance#gratitude#happiness @quietworld🍃
@QuietWorld · Post #7338 · 04.06.2020 г., 15:56
Things to Remember🍃 #thingstoremember#quotes#selfreminder#selfcare#life#assurance @quietworld🍃
@QuietWorld · Post #7341 · 05.06.2020 г., 15:02
#thingstoremember#life#selfcare#selfreminder#assurance#solitude @quietworld🍃