@sgmrt · Post #1504 · 20.09.2022 г., 23:04
[NSL]: Train services has resumed. Free regular bus services between #Yishun and #ToaPayoh has ceased. - SMRT
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
Пребарај: #toapayoh
@sgmrt · Post #1504 · 20.09.2022 г., 23:04
[NSL]: Train services has resumed. Free regular bus services between #Yishun and #ToaPayoh has ceased. - SMRT
@sgmrt · Post #1503 · 20.09.2022 г., 22:49
[NSL] UPDATE: Due to a track fault, pls add 15mins train travel time btwn #Yishun and #ToaPayoh. Free regular bus svcs from #Yishun to #ToaPayoh. - SMRT
@sgmrt · Post #1501 · 20.09.2022 г., 22:23
[NSL]: Due to a track fault, pls add 15mins train travel time btwn #Yishun and #ToaPayoh. Free regular bus svcs from #Yishun to #ToaPayoh. Our station staff will assist. - SMRT
@sgmrt · Post #1500 · 20.09.2022 г., 22:07
[NSL]: Due to a track fault, pls add 15mins train travel time btwn #Yishun and #ToaPayoh. - SMRT
@sgmrt · Post #2386 · 08.07.2025 г., 01:54
[NSL] UPDATE: Track fault cleared, train services are progressively being restored. Please add 10mins train travel time from #ToaPayoh to #Somerset. - SMRT
@sgmrt · Post #2318 · 16.04.2025 г., 04:29
[NSL]: Due to a track fault, please add 15mins travel time from #ToaPayoh to #Bishan towards #JurongEast. Free regular buses are available between #ToaPayoh and #Bishan. - SMRT
Hashtags
@sgmrt · Post #2317 · 16.04.2025 г., 04:14
[NSL]: Due to a track fault, please add 15mins train travel time from #ToaPayoh to #Bishan towards #JurongEast. Free regular buses are available between #ToaPayoh and #Bishan. Please look out for fellow commuters with special needs and lend a helping hand. We are sorry for - SMRT
Hashtags
@sgmrt · Post #2316 · 16.04.2025 г., 04:05
[NSL]: Due to a track fault, please add 15mins train travel time from #ToaPayoh to #Bishan towards #JurongEast. Free regular bus is available between #ToaPayoh and #Bishan. (Refer to Diagram 1) https://bit.ly/3YBCjlJ - SMRT
Hashtags
@sgmrt · Post #2314 · 16.04.2025 г., 03:29
[NSL]: Due to a track fault, pls add 15mins train travel time from #ToaPayoh to #Bishan towards #JurongEast. Free regular bus is available between #ToaPayoh and #Bishan. - SMRT
Hashtags
@sgmrt · Post #2226 · 10.01.2025 г., 10:44
[NSL] CLEARED: Fault cleared, train service between #MarinaSouthPier and #Bishan has resumed. Free regular bus svc btwn #MarinaSouthPier and #ToaPayoh has ceased. - SMRT
Hashtags
@sgmrt · Post #2225 · 10.01.2025 г., 10:39
[NSL] UPDATE: Train service between #MarinaSouthPier and #Bishan has resumed. Free regular bus svc btwn #MarinaSouthPier and #ToaPayoh has ceased. Trains are running normally. - SMRT
Hashtags
@sgmrt · Post #2224 · 10.01.2025 г., 10:34
[NSL] UPDATE: Train service between #MarinaSouthPier and #Bishan has resumed. Free regular bus svc btwn #MarinaSouthPier and #ToaPayoh is still available. - SMRT
Hashtags