@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 #418 · 9 мар.
Оператор pipe позволяет писать более компактный код, реализуя логику объединения данных (Union). Важно помнить, что его поведение зависит от контекста. Побитовые операции (логическое OR) result = 5 | 3 # 5 (0101) | 3 (0011) = 7 (0111) Самое главное - не путать с оператором or, это другое! Объединение множеств set_a = {1, 2, 3} set_b = {3, 4, 5} set_c = set_a | set_b # {1, 2, 3, 4, 5} set_c |= {5, 6} # {1, 2, 3, 4, 5, 6} Слияние словарей dict_1 = {"a": 1, "b": 2} dict_2 = {"b": 3, "c": 4} merged = dict_1 | dict_2 # {'a': 1, 'b': 3, 'c': 4} merged |= {"d": 5} # {'a': 1, 'b': 3, 'c': 4, 'd': 5} Аннотации типов, заменяет Union def process_data(value: int | str) -> None: print(value) Допустимо использовать в isinstance или issubclass isinstance(3, int | float) # True Паттерн-матчинг status_code = 404 match status_code: case 200 | 201 | 204: print("OK") case 400 | 404 | 500: print("ERROR") Для использования в своих классах требуется переопределить метод __or__ Так же нашел библиотеку pipe которая добавляет еще много возможностей. Рекомендую ознакомиться ;) #basic
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