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 слични објави

Пребарај: #wales

当前筛选 #wales清除筛选
Anarcho Gardening

@anarchogardening · Post #3171 · 26.03.2026 г., 14:27

Good idea: trees instead of barriers https://www.bbc.com/news/articles/cqxdxg7j3qgo After that devastating day, a group of villagers came together with an idea - they would plant trees, thousands of them, to try to reduce the risk of flooding in the future. Trees and woods play a "vital" role in reducing flooding by slowing down the flow of rainwater, absorbing rainwater and reducing erosion, according to the Woodland Trust. #trees , #floods, #wales https://ieji.de/@MinistryOfGoodIdeas/116283802113284702

AI match predictions

@ai_match_prediction · Post #11187 · 26.03.2026 г., 09:05

World Cup - Qualification Europe🌍 2026-03-26 17:00 UTC Türkiye vs. Romania Predicted outcome: Türkiye✅ Predicted score: 3:1 Actual: Türkiye 1:0 #Turkey#Romania 2026-03-26 19:45 UTC Denmark vs. FYR Macedonia Predicted outcome: Denmark✅ Predicted score: 3:1 Actual: Denmark 4:0 #Denmark#Macedonia 2026-03-26 19:45 UTC Poland vs. Albania Predicted outcome: Poland✅ Predicted score: 1:0 Actual: Poland 2:1 #Poland#Albania 2026-03-26 19:45 UTC Wales vs. Bosnia & Herzegovina Predicted outcome: Wales❌ Predicted score: 3:2 Actual: Draw 1:1 #Wales#BosniaandHerzegovina 2026-03-26 19:45 UTC Italy vs. Northern Ireland Predicted outcome: Italy✅ Predicted score: 2:1 Actual: Italy 2:0 #Italy#NorthernIreland 2026-03-26 19:45 UTC Czech Republic vs. Rep. Of Ireland Predicted outcome: Czech Republic❌ Predicted score: 1:0 Actual: Draw 2:2 #CzechRepublic#RepublicofIreland 2026-03-26 19:45 UTC Ukraine vs. Sweden Predicted outcome: Draw❌ Predicted score: 2:2 Actual: Sweden 1:3 #Ukraine#Sweden 2026-03-26 19:45 UTC Slovakia vs. Kosovo Predicted outcome: Draw❌ Predicted score: 1:1 Actual: Kosovo 3:4 #Slovakia#Kosovo #Football#WorldCup

AI match predictions

@ai_match_prediction · Post #11224 · 31.03.2026 г., 01:05

Friendlies🏳 2026-03-31 17:30 UTC South Africa vs. Panama Predicted outcome: South Africa❌ Predicted score: 2:1 Actual: Panama 1:2 #SouthAfrica#Panama 2026-03-31 17:30 UTC Jordan vs. Nigeria Predicted outcome: Nigeria❌ Predicted score: 1:2 Actual: Draw 2:2 #Jordan#Nigeria 2026-03-31 18:00 UTC Peru vs. Honduras Predicted outcome: Peru❌ Predicted score: 2:1 Actual: Draw 2:2 #Peru#Honduras 2026-03-31 18:00 UTC Morocco vs. Paraguay Predicted outcome: Morocco✅ Predicted score: 2:0 Actual: Morocco 2:1 #Morocco#Paraguay 2026-03-31 18:00 UTC Guinea vs. Benin Predicted outcome: Draw❌ Predicted score: 1:1 Actual: Benin 0:1 #Guinea#Benin 2026-03-31 18:30 UTC Scotland vs. Ivory Coast Predicted outcome: Draw❌ Predicted score: 1:1 Actual: Ivory Coast 0:1 #Scotland#IvoryCoast 2026-03-31 18:30 UTC Algeria vs. Uruguay Predicted outcome: Algeria❌ Predicted score: 2:0 Actual: Draw 0:0 #Algeria#Uruguay 2026-03-31 18:45 UTC England vs. Japan Predicted outcome: England❌ Predicted score: 1:0 Actual: Japan 0:1 #England#Japan 2026-03-31 18:45 UTC Ukraine vs. Albania Predicted outcome: Albania❌ Predicted score: 1:2 Actual: Ukraine 1:0 #Ukraine#Albania 2026-03-31 18:45 UTC Austria vs. South Korea Predicted outcome: Draw❌ Predicted score: 1:1 Actual: Austria 1:0 #Austria#SouthKorea 2026-03-31 18:45 UTC Netherlands vs. Ecuador Predicted outcome: Draw✅ Predicted score: 1:1 Actual: Draw 1:1 #Netherlands#Ecuador 2026-03-31 18:45 UTC Wales vs. Northern Ireland Predicted outcome: Draw✅ Predicted score: 1:1 Actual: Draw 1:1 #Wales#NorthernIreland 2026-03-31 18:45 UTC Slovakia vs. Romania Predicted outcome: Slovakia✅ Predicted score: 3:1 Actual: Slovakia 2:0 #Slovakia#Romania 2026-03-31 18:45 UTC Rep. Of Ireland vs. FYR Macedonia Predicted outcome: Rep. Of Ireland❌ Predicted score: 2:0 Actual: Draw 0:0 #RepublicofIreland#Macedonia 2026-03-31 19:00 UTC Spain vs. Egypt Predicted outcome: Spain❌ Predicted score: 1:0 Actual: Draw 0:0 #Spain#Egypt 2026-03-31 19:00 UTC Senegal vs. Gambia Predicted outcome: Senegal✅ Predicted score: 5:1 Actual: Senegal 3:1 #Senegal#Gambia 2026-03-31 19:00 UTC Burkina Faso vs. Guinea-Bissau Predicted outcome: Burkina Faso❌ Predicted score: 2:0 Actual: Draw 1:1 #BurkinaFaso#GuineaBissau 2026-03-31 19:00 UTC Brazil U20 vs. Paraguay U20 Predicted outcome: Brazil U20✅ Predicted score: 3:1 Actual: Brazil U20 3:1 #BrazilU20#ParaguayU20 #Football#Friendlies