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

Резултати

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

Пребарај: #studentssuccess

当前筛选 #studentssuccess清除筛选
Andijan Development Center

@adceducate · Post #8253 · 12.03.2024 г., 13:25

We would like to share CEFR results from our MAIN branch, a.ka. home of real achievers 🥳🔥 Abrorbek Patiddinov B2/52 Nozimaxon Akbarova: B2/53 And Muhammadali Abdumalikov C1/65 Their teacher: Mr.Shermuhammad 🎉 Congratulations on their initial academic accomplishments!!! 🎉 And, we hope to see them get high results from IELTS, as well! We also would like to extend our gratitude to their teacher, Mr. Shermuhammad, for his tireless efforts to produce such results week in and week out! 🤝 To join our courses, call 742281121 #studentssuccess ADC - The Way To Knowledge

Andijan Development Center

@adceducate · Post #8141 · 11.01.2024 г., 12:21

We would like to share CEFR results from our MAIN branch, a.ka. home of real achievers 🥳🔥 So, here we go! Bexruz; B2/53 (L and R: 58) Shoxjahon; B2/58 (L 64 and Sp 66) Rahmonberdi; B2/54 (L 57 and Sp 56) Diyora; B2/61 (L 73 🥳 R 67 🔥) And Asliddin; C1/66 (L 70 and R 68) 🎉 Congratulations on their initial academic accomplishments!!! 🎉 And, we hope to see them get high results from IELTS, as well! We also would like to extend our gratitude to their teacher, Mr. Shermuhammad, for his tireless efforts to produce such results week in and week out! 🤝 To join our courses, call 742281121 #studentssuccess ADC - The Way To Knowledge

Andijan Development Center

@adceducate · Post #8251 · 11.03.2024 г., 12:46

YANA BIR BAND 7️⃣.0️⃣👑 🤜BAND 7.0🤜 LISTENING: 7.0 🚀 READING: 7.5 🤓 WRITING: 6.5✍️ SPEAKING: 7.0 🔥 Full Name: Charos Rustamova👑 Attempt: 1st ✨ With British Council Age: 16 🤯 Teacher: Mr. Shermuhammad (8.5) General English, working hard and choosing the right teacher are the key elements to success in IELTS🍸 #ieltsresult#studentssuccess#band70#mainoffice THINK IELTS, THINK ADC