@QuietWorld · Post #6726 · 17.10.2019 г., 13:01
It's often just enough to be with someone. I don't need to touch them. Not even talk. A feeling passes between you both. You're not alone. – Marilyn Monroe #solitude@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
Пребарај: #solitude
@QuietWorld · Post #6726 · 17.10.2019 г., 13:01
It's often just enough to be with someone. I don't need to touch them. Not even talk. A feeling passes between you both. You're not alone. – Marilyn Monroe #solitude@quietworld🍃
Hashtags
@QuietWorld · Post #6722 · 16.10.2019 г., 23:30
I have to be alone very often. I'd be quite happy if I spent from Saturday night until Monday morning alone in my apartment. That's how I refuel. – Audrey Hepburn #solitude@quietworld🍃
Hashtags
@QuietWorld · Post #6714 · 15.10.2019 г., 08:30
A man can be himself only so long as he is alone. – Arthur Schopenhauer #solitude @quietworld🍃
Hashtags
@QuietWorld · Post #6705 · 14.10.2019 г., 08:30
If you make friends with yourself you will never be alone. – Maxwell Maltz #solitude#quotes @quietworld🍃
@QuietWorld · Post #6701 · 13.10.2019 г., 23:30
Alone let him constantly meditate in solitude on that which is salutary for his soul, for he who meditates in solitude attains supreme bliss. – Guru Nanak #solitude#quotes @quietworld🍃
@QuietWorld · Post #6700 · 13.10.2019 г., 13:00
"There's a tremendous difference between alone and lonely. You could be lonely in a group of people. I like being alone. I like eating by myself. I go home at night and just watch a movie or hang out with my dog. I have to exert myself and really say, oh God, I've got to see my friends 'cause I'm too content being by myself." - Drew Barrymore - #quotes#solitude @quietworld🍃
@QuietWorld · Post #6673 · 09.10.2019 г., 12:00
We visit others as a matter of social obligation. How long has it been since we have visited ourselves? #solitude#quotes @quietworld🍃
@QuietWorld · Post #6670 · 09.10.2019 г., 00:00
Solitude is a good place to visit but a poor place to stay. —Josh Billings – #solitude#quotes @quietworld🍃
@QuietWorld · Post #6668 · 08.10.2019 г., 12:00
When we cannot bear to be alone, it means we do not properly value the only companion we will have from birth to death — ourselves. – Morris Adler – #solitude#quotes @quietworld🍃
@QuietWorld · Post #6662 · 08.10.2019 г., 05:00
There's one thing worse than being alone – wishing you were. #solitude#quotes @quietworld🍃
@QuietWorld · Post #6688 · 11.10.2019 г., 08:30
Men go abroad to wonder at the heights of mountains, at the huge waves of the sea, at the long courses of the rivers, at the vast compass of the ocean, at the circular motions of the stars; and they pass by themselves.., without wondering. – St. Augustine – #solitude#quotes#reflection @quietworld🍃
Hashtags
@QuietWorld · Post #6654 · 07.10.2019 г., 04:39
You have to start knowing yourself so well that you begin to know other people – a piece of us is in every person we can ever meet. —John D. MacDonald – #quotes#solitude#reflection @quietworld🍃
Hashtags