@UltimoraPOlitics · Post #38567 · 06.05.2022 г., 16:35
#Elezioni#RegnoUnito#IrlandaDelNord Emma #Sheering (#SF|LEFT) eletta nel seggio di #MidUlster al secondo conteggio. @UltimoraPolitics
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
Пребарај: #midulster
@UltimoraPOlitics · Post #38567 · 06.05.2022 г., 16:35
#Elezioni#RegnoUnito#IrlandaDelNord Emma #Sheering (#SF|LEFT) eletta nel seggio di #MidUlster al secondo conteggio. @UltimoraPolitics
@UltimoraPOlitics · Post #38566 · 06.05.2022 г., 16:34
#Elezioni#RegnoUnito#IrlandaDelNord Linda #Dillon (#SF|LEFT) eletto nel seggio di #MidUlster al secondo conteggio. @UltimoraPolitics
@UltimoraPOlitics · Post #38401 · 05.05.2022 г., 13:59
#Elezioni#RegnoUnito#IrlandaDelNord Affluenza ore 12 (dati non ufficiali) #NewryArmagh: 20,9% #BelfastWest: 20% #EastDerry: 18,9% #MidUlster: 18,1% #EastAntrim: 13,3% @UltimoraPolitics
@UltimoraPOlitics · Post #38422 · 05.05.2022 г., 17:52
#Elezioni #RegnoUnito #IrlandaDelNord Affluenza ore 17 (dati non ufficiali) #SouthBelfast: 37,3% #BelfastEast: 36,6% #EastDerry: 34% #NorthDown: 33,3% #Strangford: 32,4% #MidUlster: 31,9% @UltimoraPolitics
@UltimoraPOlitics · Post #38420 · 05.05.2022 г., 16:54
#Elezioni#RegnoUnito#IrlandaDelNord Affluenza ore 17 (dati non ufficiali) #SouthBelfast: 37,3% #BelfastEast: 36,6% #EastDerry: 34% #NorthDown: 33,3% #Strangford: 32,4% #MidUlster: 31,9% @UltimoraPolitics
@UltimoraPOlitics · Post #38493 · 06.05.2022 г., 12:41
#Elezioni #RegnoUnito #IrlandaDelNord Affluenza definitiva (Post in continuo aggiornamento) #MidUlster: 69,5% #FermanaghSouthTyrone: 69,1% #NewryArmagh: 68,5% #WestTyrone: 66,9% #SouthDown: 66,2% #BelfastWest: 64,7% #SouthBelfast: 64,4% #LaganValley: 63…
@UltimoraPOlitics · Post #38424 · 05.05.2022 г., 18:19
#Elezioni #RegnoUnito #IrlandaDelNord Aggiornamento affluenza ore 17 (dati non ufficiali) #NorthBelfast: 35,7% #SouthDown: 35,7% #EastDerry: 34,8% #SouthBelfast: 34,2% #BelfastEast: 33,7% #NorthDown: 33,3% #Strangford: 32,8% #MidUlster: 32,6% #UpperBann:…
@UltimoraPOlitics · Post #38486 · 06.05.2022 г., 12:10
#Elezioni#RegnoUnito#IrlandaDelNord Affluenza definitiva (Post in continuo aggiornamento) #MidUlster: 69,5% #FermanaghSouthTyrone: 69,1% #NewryArmagh: 68,5% #WestTyrone: 66,9% #SouthDown: 66,2% #BelfastWest: 64,7% #SouthBelfast: 64,4% #LaganValley: 63,2% #BelfastEast: 62,5% #UpperBann: 62,5% #NorthAntrim: 62,5% #NorthBelfast: 61,7% #Foyle: 61,6% #EastDerry: 61,4% #NorthDown: 60,1% #EastAntrim: 60,1% #SouthAntrim: 60% #Strangford: 58,4% @UltimoraPolitics