TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

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

Резултати

Пронајдени 2 слични објави

Пребарај: #mainland

当前筛选 #mainland清除筛选
籽煤 yseedsmedia

@yseedsmedia · Post #492 · 04.01.2022 г., 07:24

行政長官林鄭月娥表示,香港與內地的通關進度受近期本港確診新冠病毒個案數字上升所影響。這表示,香港再次需要等待一段時間,才有機會與內地恢復正常往來及通關。 林鄭月娥亦表示,對國泰違規機組人員不負責任行為感到非常不滿,直言他們因為一時之快,令社會付出龐大代價,會再審視是否有法律基礎,或對違規機組人員採取法律行動。 #林鄭#行政長官#林鄭月娥#特首#通關#通關無期#國泰#機組人員#一個累全家#法律#譴責#法律行動#新冠#omicron#virus#cathypacific#travel#mainland#covid19#covid #yseedsmedia#籽煤#新聞#熱門新聞#香港人的新聞#香港人#hongkonger#香港加油 Follow and share us: IG: instagram.com/yseedsmedia/ Fb: fb.com/yseedsmedia Tg: t.me/yseedsmedia

Tg Links

@TgDict · Post #9 · 09.03.2021 г., 11:27

#Start#contents#index#mark This channel publishes groups and channels according to a main directory and several subject sub-directories for index search The search keywords are as follows: One type of keywords: Nine categories of first-level keywords Two types of keywords: Second-level keywords + geographic region + language family 1. Telegraph #telegram#Promotion #Group#channel#robot #Search#index#navigation 2. Resources #Resources#Share #Sharing#Welfare#moive#music#Books 3. Broadcasting #Broadcasting #message#info#news#blog 4. Chat category #Chat #chitchat#communication#city#area #Chinese#English#language#country #Mainland#HongKong#Taiwan 5. Computer category #Computer #Hardware#software#VPN#programming 6. Life category #life #Entertainment#Game#Funny#Anime #Live#tourism 7. Subjects #Subjects #Interest#hobbies#topic 8.Industry #Industry#business 9.To be classified #notes Unclassified