@artematizando · Post #4842 · 31.05.2025 г., 18:35
John #Martin, Alpheus and Arethusa (1832)
Hashtags
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
Пребарај: #martin
@artematizando · Post #4842 · 31.05.2025 г., 18:35
John #Martin, Alpheus and Arethusa (1832)
Hashtags
@artematizando · Post #4743 · 13.10.2024 г., 14:48
John #Martin, The Great Day of His Wrath (1853)
Hashtags
@artematizando · Post #4718 · 20.08.2024 г., 13:26
John #Martin, The Seventh Plague of Egypt (1823)
Hashtags
@artematizando · Post #4618 · 28.01.2024 г., 15:55
John #Martin, Joshua Commanding the Sun to Stand Still upon Gibeon (1816)
Hashtags
@artematizando · Post #4184 · 28.09.2022 г., 11:07
John #Martin, The Destruction of Pharaoh’s Host (1836)
Hashtags
@artematizando · Post #3977 · 22.04.2022 г., 14:03
John #Martin, The Fall of Babylon; Cyrus the Great Defeating the Chaldean (1831)
Hashtags
@artematizando · Post #3720 · 17.12.2021 г., 11:54
John #Martin, Belshazzar's Feast (1826)
Hashtags
@artematizando · Post #3719 · 17.12.2021 г., 11:54
John #Martin, Satan Presiding at the Infernal Council (ca. 1827)
Hashtags
@artematizando · Post #3610 · 25.10.2021 г., 07:50
John #Martin, Satan Viewing the Ascent to Heaven (1824)
Hashtags
@artematizando · Post #3374 · 17.07.2021 г., 12:22
John #Martin, Lot and his Family flee Sodom as it burns
Hashtags
@MLB_Daily · Post #16371 · 17.12.2025 г., 12:55
🤠🤝 Los Rangers y el lanzador derecho Chris Martin supuestamente acordaron un contrato de un año, según múltiples informes, incluido el de Mark Feinsand de MLB. #️⃣#Rangers#Martin 🗞 | t.me/MLB_Daily
@bighitxtcom · Post #82623 · 18.04.2026 г., 11:35
[TIKTOK] 260418 | @txt.bighitent “just stick with #MARTIN & #JUHOON🫂@cortis_bighit” (vt.tiktok.com/ZSHTrRBgb/) #투모로우바이투게더#TOMORROW_X_TOGETHER#TXT #휴닝카이#HUENINGKAI #CORTIS#코르티스 #7TH_YEAR#가시덤불에_잠시_바람이_멈췄을_때#하루에_하루만_더#Stick_With_You